diff mbox series

[v7,3/4] spi: Update swnode based SPI devices to use the fwnode name

Message ID 20240416100904.3738093-4-ckeepax@opensource.cirrus.com (mailing list archive)
State Accepted
Commit ed8921188f3568ba1659ff041f21e83565c74ec2
Headers show
Series Add bridged amplifiers to cs42l43 | expand

Commit Message

Charles Keepax April 16, 2024, 10:09 a.m. UTC
Update the name for software node based SPI devices to use the fwnode
name as the device name. This is helpful since swnode devices are
usually added within the kernel, and the kernel often then requires a
predictable name such that it can refer back to the device.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

No changes since v6.

Thanks,
Charles

 drivers/spi/spi.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index d1f82a35f2d0..4fcaadf8a484 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -605,6 +605,11 @@  static void spi_dev_set_name(struct spi_device *spi)
 		return;
 	}
 
+	if (is_software_node(fwnode)) {
+		dev_set_name(dev, "spi-%pfwP", fwnode);
+		return;
+	}
+
 	dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->controller->dev),
 		     spi_get_chipselect(spi, 0));
 }