* [PATCH v2] usb: typec: Remove alt->adev.dev.class assignment
@ 2026-03-24 10:29 Andrei Kuchynski
2026-03-24 11:08 ` Heikki Krogerus
2026-03-24 20:56 ` Benson Leung
0 siblings, 2 replies; 3+ messages in thread
From: Andrei Kuchynski @ 2026-03-24 10:29 UTC (permalink / raw)
To: Heikki Krogerus, linux-usb, linux-kernel
Cc: Greg Kroah-Hartman, Andrei Kuchynski, stable, Madhu M
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
Cc: stable@vger.kernel.org
Fixes: 67ab45426215 ("usb: typec: Set the bus also for the port and plug altmodes")
Tested-by: Madhu M <madhu.m@intel.corp-partner.google.com>
Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
---
Changes in V2:
- Marked as a Fix
drivers/usb/typec/class.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index 8314309094719..0977581ad1b6e 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -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",
--
2.53.0.983.g0bb29b3bc5-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] usb: typec: Remove alt->adev.dev.class assignment
2026-03-24 10:29 [PATCH v2] usb: typec: Remove alt->adev.dev.class assignment Andrei Kuchynski
@ 2026-03-24 11:08 ` Heikki Krogerus
2026-03-24 20:56 ` Benson Leung
1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2026-03-24 11:08 UTC (permalink / raw)
To: Andrei Kuchynski
Cc: linux-usb, linux-kernel, Greg Kroah-Hartman, stable, Madhu M
On Tue, Mar 24, 2026 at 10:29:03AM +0000, Andrei Kuchynski wrote:
> 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
>
> Cc: stable@vger.kernel.org
> Fixes: 67ab45426215 ("usb: typec: Set the bus also for the port and plug altmodes")
> Tested-by: Madhu M <madhu.m@intel.corp-partner.google.com>
> Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> Changes in V2:
> - Marked as a Fix
>
> drivers/usb/typec/class.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 8314309094719..0977581ad1b6e 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -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,
--
heikki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] usb: typec: Remove alt->adev.dev.class assignment
2026-03-24 10:29 [PATCH v2] usb: typec: Remove alt->adev.dev.class assignment Andrei Kuchynski
2026-03-24 11:08 ` Heikki Krogerus
@ 2026-03-24 20:56 ` Benson Leung
1 sibling, 0 replies; 3+ messages in thread
From: Benson Leung @ 2026-03-24 20:56 UTC (permalink / raw)
To: Andrei Kuchynski
Cc: Heikki Krogerus, linux-usb, linux-kernel, Greg Kroah-Hartman,
stable, Madhu M
[-- Attachment #1: Type: text/plain, Size: 1844 bytes --]
On Tue, Mar 24, 2026 at 10:29:03AM +0000, Andrei Kuchynski wrote:
> 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
>
> Cc: stable@vger.kernel.org
> Fixes: 67ab45426215 ("usb: typec: Set the bus also for the port and plug altmodes")
> Tested-by: Madhu M <madhu.m@intel.corp-partner.google.com>
> Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
> ---
> Changes in V2:
> - Marked as a Fix
>
> drivers/usb/typec/class.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 8314309094719..0977581ad1b6e 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -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",
> --
> 2.53.0.983.g0bb29b3bc5-goog
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-24 20:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 10:29 [PATCH v2] usb: typec: Remove alt->adev.dev.class assignment Andrei Kuchynski
2026-03-24 11:08 ` Heikki Krogerus
2026-03-24 20:56 ` Benson Leung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox