The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Akshay Gujar <Akshay.Gujar@harman.com>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	naveen.v@harman.com, oneukum@suse.com, stern@rowland.harvard.edu
Subject: Re: [PATCH v6 3/3] usb: hub: send enumeration failure uevent
Date: Thu, 3 Dec 2026 18:15:21 +0100	[thread overview]
Message-ID: <2026120300-tall-coming-c742@gregkh> (raw)
In-Reply-To: <20260802233108.70950-4-Akshay.Gujar@harman.com>

On Sun, Aug 02, 2026 at 11:31:08PM +0000, Akshay Gujar wrote:
> Emit a structured uevent when USB device enumeration fails in
> hub_port_connect(), supplementing the existing error log with a
> notification userspace can act on.
> 
> The event is emitted from the port's parent, the hub interface, because
> usb_port devices have neither a bus nor a class and dev_uevent_filter()
> drops any uevent sent from them. The failing port is named in the
> payload.
> 
> Signed-off-by: Akshay Gujar <Akshay.Gujar@harman.com>
> ---
>  drivers/usb/core/hub.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 5262e11c12cd3..78275dd702ceb 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -5613,9 +5613,21 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
>  	if (hub->hdev->parent ||
>  			!hcd->driver->port_handed_over ||
>  			!(hcd->driver->port_handed_over)(hcd, port1)) {
> -		if (status != -ENOTCONN && status != -ENODEV)
> +		if (status != -ENOTCONN && status != -ENODEV) {
> +			int ret;
>  			dev_err(&port_dev->dev,
>  					"unable to enumerate USB device\n");
> +
> +			/* usb_port has no bus or class, so uevents from it
> +			 * are dropped; emit from the hub interface instead.
> +			 */
> +			ret = device_enumeration_failure_notify(port_dev->dev.parent,
> +								dev_name(&port_dev->dev));

This still feels wrong, the port is a device, and as such should be the
thing that emits the event so that you know exactly what port had the
problem (otherwise you have to somehow parse the name of the port in the
string after the device name, which is wrong...)

Also the comment is in the wrong style.  I could live with that, but not
the port issue.

If the real solution is to put the port on the bus, or have a class,
then do that as that needs to be fixed up so you get the actual port
that is having the problem here, not the "hub".

thanks,

greg k-h

  reply	other threads:[~2026-12-04  3:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02 23:31 [PATCH v6 0/3] driver core: add enumeration failure uevent helper Akshay Gujar
2026-08-02 23:31 ` [PATCH v6 1/3] driver core: add device_enumeration_failure_notify() helper Akshay Gujar
2026-08-02 23:31 ` [PATCH v6 2/3] Documentation: ABI: document DEVICE_ENUMERATION_FAILURE uevent Akshay Gujar
2026-08-02 23:31 ` [PATCH v6 3/3] usb: hub: send enumeration failure uevent Akshay Gujar
2026-12-03 17:15   ` Greg KH [this message]
2026-08-10  8:23 ` [PATCH v6 0/3] driver core: add enumeration failure uevent helper Akshay Gujar
2026-08-10  8:24 ` Akshay Gujar
2026-08-18  6:10 ` Akshay Gujar
2026-08-18  6:40   ` Greg KH
2026-09-17 16:42     ` Akshay Gujar
2026-12-03 17:15       ` Greg KH

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=2026120300-tall-coming-c742@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=Akshay.Gujar@harman.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=naveen.v@harman.com \
    --cc=oneukum@suse.com \
    --cc=stern@rowland.harvard.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox