usb: typec: Remove alt->adev.dev.class assignment
Subsystems (3)
PATCH v2 1/1 usb: typec: Remove alt->adev.dev.class assignment
The typec plug alternate mode is already registered as part of the bus. When both class and bus are set for a device, device_add() attempts to create the "subsystem" symlink in the device's sysfs directory twice, once for the bus and once for the class.
This results in a duplicate filename error during registration, causing the alternate mode registration to fail with warnings:
cannot create duplicate filename '/devices/pci0000:00/0000:00:1f.0/
PNP0C09:00/GOOG0004:00/cros-ec-dev.1.auto/cros_ec_ucsi.3.auto/typec/ port1/port1-cable/port1-plug0/port1-plug0.0/subsystem'
typec port0-plug0: failed to register alternate mode (-17) cros_ec_ucsi.3.auto: failed to registers svid 0x8087 mode 1
---
Changes in V2:
- Marked as a Fix
drivers/usb/typec/class.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/usb/typec/class.c +0 -4
@@ -686,10 +686,6 @@ typec_register_altmode(struct device *parent, alt->adev.dev.bus = &typec_bus; -/* Plug alt modes need a class to generate udev events. */ -if (is_typec_plug (parent)) - alt->adev.dev.class = &typec_class; - ret =device_register (&alt->adev.dev);if (ret) { dev_err(parent, "failed to register alternate mode (%d)\n",
Signature · 1 line
2.53.0.983.g0bb29b3bc5-goog
Quoted 13 lines · Andrei Kuchynski
The typec plug alternate mode is already registered as part of the bus. When both class and bus are set for a device,
device_add()attempts to create the "subsystem" symlink in the device's sysfs directory twice, once for the bus and once for the class.
This results in a duplicate filename error during registration, causing the alternate mode registration to fail with warnings:cannot create duplicate filename '/devices/pci0000:00/0000:00:1f.0/
PNP0C09:00/GOOG0004:00/cros-ec-dev.1.auto/cros_ec_ucsi.3.auto/typec/ port1/port1-cable/port1-plug0/port1-plug0.0/subsystem'
typec port0-plug0: failed to register alternate mode (-17) cros_ec_ucsi.3.auto: failed to registers svid0x8087mode 1
Quoted 4 lines
Fixes 67ab45426215 ("usb: typec: Set the bus also for the port and plug altmodes")Tested-by Madhu M <[email protected]>Signed-off-by Andrei Kuchynski <[email protected]>
Quoted 12 lines
---
Changes in V2:
- Marked as a Fixdrivers/usb/typec/class.c | 4 ---- 1 file changed, 4 deletions(-)drivers/usb/typec/class.c +0
-0
drivers/usb/typec/class.c typec_register_altmode(struct device *parent, · line 691
Quoted 10 lines
drivers/usb/typec/class.c +0
-4@@ -686,10 +686,6 @@ typec_register_altmode(struct device *parent, alt->adev.dev.bus = &typec_bus; -/* Plug alt modes need a class to generate udev events. */ -if (is_typec_plug (parent)) - alt->adev.dev.class = &typec_class; - ret =device_register (&alt->adev.dev);if (ret) { dev_err(parent, "failed to register alternate mode (%d)\n",
thanks,
Signature · 1 line
heikki
Quoted 13 lines · Andrei Kuchynski
The typec plug alternate mode is already registered as part of the bus. When both class and bus are set for a device,
device_add()attempts to create the "subsystem" symlink in the device's sysfs directory twice, once for the bus and once for the class.
This results in a duplicate filename error during registration, causing the alternate mode registration to fail with warnings:cannot create duplicate filename '/devices/pci0000:00/0000:00:1f.0/
PNP0C09:00/GOOG0004:00/cros-ec-dev.1.auto/cros_ec_ucsi.3.auto/typec/ port1/port1-cable/port1-plug0/port1-plug0.0/subsystem'
typec port0-plug0: failed to register alternate mode (-17) cros_ec_ucsi.3.auto: failed to registers svid0x8087mode 1
Quoted 4 lines
Fixes 67ab45426215 ("usb: typec: Set the bus also for the port and plug altmodes")Tested-by Madhu M <[email protected]>Signed-off-by Andrei Kuchynski <[email protected]>
Quoted 26 lines
---
Changes in V2:
- Marked as a Fixdrivers/usb/typec/class.c | 4 ---- 1 file changed, 4 deletions(-)drivers/usb/typec/class.c +0
-4@@ -686,10 +686,6 @@ typec_register_altmode(struct device *parent, alt->adev.dev.bus = &typec_bus; -/* Plug alt modes need a class to generate udev events. */ -if (is_typec_plug (parent)) - alt->adev.dev.class = &typec_class; - ret =device_register (&alt->adev.dev);if (ret) { dev_err(parent, "failed to register alternate mode (%d)\n",Signature · 1 line
2.53.0.983.g0bb29b3bc5-goog