From: Charles Keepax Date: Tue, 16 Apr 2024 10:09:03 +0000 (+0100) Subject: spi: Update swnode based SPI devices to use the fwnode name X-Git-Tag: v6.10-rc1~171^2~23^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed8921188f3568ba1659ff041f21e83565c74ec2;p=thirdparty%2Fkernel%2Flinux.git spi: Update swnode based SPI devices to use the fwnode name 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 Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20240416100904.3738093-4-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 26f287d8d9463..555fbe200733d 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)); }