lkml.org 
[lkml]   [2022]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] usb: core: add a hook to check port init status
On Tue, Aug 16, 2022 at 04:38:53PM +0800, Ray Chi wrote:
> This patch add a hook to check the port init status. Currently, only
> usbcore knows port init status even if the result is bad. It will cause
> a USB host keep doing USB enumeration for a long time when the USB host
> connects to a broken USB accessory.
>
> The hc_driver could use the hook to know port init status and do possible
> error handling according to platform requirements or limitations.
>
> Signed-off-by: Ray Chi <raychi@google.com>
> ---
> drivers/usb/core/hub.c | 14 ++++++++++++++
> include/linux/usb/hcd.h | 8 ++++++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 2633acde7ac1..6ce6092816cb 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c

> @@ -4855,6 +4865,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
> buf->bMaxPacketSize0;
> kfree(buf);
>
> + retval = hub_port_check_init_status(udev, r);
> + if (retval < 0)
> + goto fail;

For future reference, you should be aware that this code won't get
executed if do_new_scheme is false.

Alan Stern

\
 
 \ /
  Last update: 2022-08-16 15:55    [W:0.120 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site