Message ID | 20240409132126.1117916-3-ckeepax@opensource.cirrus.com |
---|---|
State | New |
Headers | show |
Series | Add bridged amplifiers to cs42l43 | expand |
On Tue, Apr 09, 2024 at 02:21:25PM +0100, Charles Keepax wrote: > Add a mechanism to force the use of the fwnode name for the name of the > SPI device itself. This is useful when devices need to be manually added > within the kernel. > > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> > --- Apologies looking at this I really should have updated the commit message as well. I will send a new rev soon if there are no new comments. Thanks, Charles
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index a2f01116ba09..52c70705d179 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -598,12 +598,18 @@ EXPORT_SYMBOL_GPL(spi_alloc_device); static void spi_dev_set_name(struct spi_device *spi) { struct acpi_device *adev = ACPI_COMPANION(&spi->dev); + struct fwnode_handle *fwnode = dev_fwnode(&spi->dev); if (adev) { dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev)); return; } + if (is_software_node(fwnode)) { + dev_set_name(&spi->dev, "spi-%s", fwnode_get_name(fwnode)); + return; + } + dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->controller->dev), spi_get_chipselect(spi, 0)); }
Add a mechanism to force the use of the fwnode name for the name of the SPI device itself. This is useful when devices need to be manually added within the kernel. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> --- Changes since v3: - Always name swnode SPI devices after the node name Thanks, Charles drivers/spi/spi.c | 6 ++++++ 1 file changed, 6 insertions(+)