diff mbox series

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

Message ID 20240415140925.3518990-4-ckeepax@opensource.cirrus.com
State New
Headers show
Series Add bridged amplifiers to cs42l43 | expand

Commit Message

Charles Keepax April 15, 2024, 2:09 p.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.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

Series changes since v5:
 - Use %pwfP to get firmware node name

Thanks,
Charles

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

Comments

Andy Shevchenko April 15, 2024, 4:09 p.m. UTC | #1
On Mon, Apr 15, 2024 at 5:09 PM Charles Keepax
<ckeepax@opensource.cirrus.com> wrote:
>
> 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.

Assuming we have no users like this right now, so there won't be any breakages.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
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));
 }