* [PATCH] spi: Only use software node name when explicitly provided
@ 2026-12-02 6:07 Dmitry Torokhov
0 siblings, 0 replies; only message in thread
From: Dmitry Torokhov @ 2026-12-02 6:07 UTC (permalink / raw)
To: Mark Brown, Charles Keepax, Andy Shevchenko; +Cc: linux-spi, linux-kernel
Commit ed8921188f35 ("spi: Update swnode based SPI devices to use the
fwnode name") changed SPI device naming so that devices backed by a
software node are always named after the firmware node.
However, when a software node does not specify a name, the core assigns
an auto-generated "node<N>" kobject name. Using that name produces
unpredictable "spi-node<N>" device names instead of the standard
"<bus>.<cs>" format that board code, regulator supply lookups, and ASoC
DAI links expect.
Check that the software node has an explicit name before using it to
name the SPI device, falling back to the standard controller and chip
select naming otherwise.
Fixes: ed8921188f35 ("spi: Update swnode based SPI devices to use the fwnode name")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
This fix is motivated by converting the SPI board info entries
(wm0010, wm5102, wm5110) in arch/arm/mach-s3c/mach-crag6410-module.c
to unnamed static software nodes. With unnamed software nodes,
spi_dev_set_name() currently assigns unpredictable "spi-node<N>" device
names, which breaks regulator supply matching in
arch/arm/mach-s3c/mach-crag6410.c and ASoC DAI link matching in
sound/soc/samsung/bells.c and sound/soc/samsung/speyside.c (which
expect "spi0.0" and "spi0.1").
Existing in-tree SPI software node users (board-nokia770.c, db1000.c,
lenovo.c, and spi-cs42l43.c) all specify explicit software node names
and continue to receive identical "spi-<name>" device names.
---
drivers/spi/spi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 0569f30785e9..d329103108d4 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -782,13 +782,15 @@ static void spi_dev_set_name(struct spi_device *spi)
{
struct device *dev = &spi->dev;
struct fwnode_handle *fwnode = dev_fwnode(dev);
+ const struct software_node *swnode;
if (is_acpi_device_node(fwnode)) {
dev_set_name(dev, "spi-%s", acpi_dev_name(to_acpi_device_node(fwnode)));
return;
}
- if (is_software_node(fwnode)) {
+ swnode = to_software_node(fwnode);
+ if (swnode && swnode->name) {
dev_set_name(dev, "spi-%pfwP", fwnode);
return;
}
---
base-commit: 253f86660c1f882fbf554db5eaa34bc5d66dc7e8
change-id: 20261201-spi-swnode-name-638eb05707ec
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 6:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 6:07 [PATCH] spi: Only use software node name when explicitly provided Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®