All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Andrei Kuchynski <akuchynski@chromium.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Madhu M <madhu.m@intel.corp-partner.google.com>
Subject: Re: [PATCH] usb: typec: Remove alt->adev.dev.class assignment
Date: Tue, 24 Mar 2026 11:43:56 +0200	[thread overview]
Message-ID: <acJc3AWs2oNIveAD@kuha> (raw)
In-Reply-To: <20260324083818.686269-1-akuchynski@chromium.org>

Tue, Mar 24, 2026 at 08:38:18AM +0000, Andrei Kuchynski kirjoitti:
> 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
> 
> Tested-by: Madhu M <madhu.m@intel.corp-partner.google.com>
> Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>

Thanks for the patch. This needs to be marked as a fix:

Fixes: 67ab45426215 ("usb: typec: Set the bus also for the port and plug altmodes")

thanks,

> ---
>  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

-- 
heikki

      reply	other threads:[~2026-03-24  9:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24  8:38 [PATCH] usb: typec: Remove alt->adev.dev.class assignment Andrei Kuchynski
2026-03-24  9:43 ` Heikki Krogerus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acJc3AWs2oNIveAD@kuha \
    --to=heikki.krogerus@linux.intel.com \
    --cc=akuchynski@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=madhu.m@intel.corp-partner.google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.