diff options
author | Charles Keepax <[email protected]> | 2024-04-16 11:09:03 +0100 |
---|---|---|
committer | Mark Brown <[email protected]> | 2024-04-16 20:00:28 +0900 |
commit | ed8921188f3568ba1659ff041f21e83565c74ec2 (patch) | |
tree | b0ee35b1d7108e5ad566f91f644006e4a0dcb596 | |
parent | 8a101146bcf014060530d71eba8edc52eca257f7 (diff) |
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 <[email protected]>
Signed-off-by: Charles Keepax <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
-rw-r--r-- | drivers/spi/spi.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 26f287d8d946..555fbe200733 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)); } |