public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soundwire: fix initializing sysfs for same devices on different buses
@ 2023-10-04 13:02 Krzysztof Kozlowski
  2023-10-04 13:11 ` Greg Kroah-Hartman
  2023-10-04 13:16 ` Pierre-Louis Bossart
  0 siblings, 2 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2023-10-04 13:02 UTC (permalink / raw)
  To: Vinod Koul, Bard Liao, Pierre-Louis Bossart, Sanyog Kale,
	Greg Kroah-Hartman, Philippe Ombredanne, Takashi Iwai, alsa-devel,
	linux-kernel
  Cc: Krzysztof Kozlowski, stable

If same devices with same device IDs are present on different soundwire
buses, the probe fails due to conflicting device names and sysfs
entries:

  sysfs: cannot create duplicate filename '/bus/soundwire/devices/sdw:0:0217:0204:00:0'

The link ID is 0 for both devices, so they should be differentiated by
bus ID.  Add the bus ID so, the device names and sysfs entries look
like:

  sdw:1:0:0217:0204:00:0 -> ../../../devices/platform/soc@0/6ab0000.soundwire-controller/sdw-master-1/sdw:1:0:0217:0204:00:0
  sdw:3:0:0217:0204:00:0 -> ../../../devices/platform/soc@0/6b10000.soundwire-controller/sdw-master-3/sdw:3:0:0217:0204:00:0

Fixes: 7c3cd189b86d ("soundwire: Add Master registration")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Sending as RFT, because I did not test it on that many devices and
user-spaces.
---
 drivers/soundwire/slave.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c
index c1c1a2ac293a..4db43ea53d47 100644
--- a/drivers/soundwire/slave.c
+++ b/drivers/soundwire/slave.c
@@ -39,14 +39,14 @@ int sdw_slave_add(struct sdw_bus *bus,
 	slave->dev.fwnode = fwnode;
 
 	if (id->unique_id == SDW_IGNORED_UNIQUE_ID) {
-		/* name shall be sdw:link:mfg:part:class */
-		dev_set_name(&slave->dev, "sdw:%01x:%04x:%04x:%02x",
-			     bus->link_id, id->mfg_id, id->part_id,
+		/* name shall be sdw:bus:link:mfg:part:class */
+		dev_set_name(&slave->dev, "sdw:%01x:%01x:%04x:%04x:%02x",
+			     bus->id, bus->link_id, id->mfg_id, id->part_id,
 			     id->class_id);
 	} else {
-		/* name shall be sdw:link:mfg:part:class:unique */
-		dev_set_name(&slave->dev, "sdw:%01x:%04x:%04x:%02x:%01x",
-			     bus->link_id, id->mfg_id, id->part_id,
+		/* name shall be sdw:bus:link:mfg:part:class:unique */
+		dev_set_name(&slave->dev, "sdw:%01x:%01x:%04x:%04x:%02x:%01x",
+			     bus->id, bus->link_id, id->mfg_id, id->part_id,
 			     id->class_id, id->unique_id);
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-10-05 15:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-04 13:02 [PATCH] soundwire: fix initializing sysfs for same devices on different buses Krzysztof Kozlowski
2023-10-04 13:11 ` Greg Kroah-Hartman
2023-10-04 13:15   ` Krzysztof Kozlowski
2023-10-04 13:16 ` Pierre-Louis Bossart
2023-10-04 13:38   ` Greg Kroah-Hartman
2023-10-04 13:57     ` Pierre-Louis Bossart
2023-10-04 14:13       ` Greg Kroah-Hartman
2023-10-04 15:16         ` Pierre-Louis Bossart
2023-10-04 15:40           ` Mark Brown
2023-10-04 19:00             ` Pierre-Louis Bossart
2023-10-04 19:08               ` Mark Brown
2023-10-05 12:24               ` Pierre-Louis Bossart
2023-10-05 12:38                 ` Mukunda,Vijendar
2023-10-05 13:37                   ` Mukunda,Vijendar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox