Re: [PATCH] Usbcore: Do not disable USB3 protocol ports in hub_activate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 3 Mar 2010, Andiry Xu wrote:

> >From 970df30f8661db0f8bc7602adfe07f469f655c86 Mon Sep 17 00:00:00 2001
> From: Andiry Xu <andiry.xu@xxxxxxx>
> Date: Wed, 3 Mar 2010 16:13:08 +0800
> Subject: [PATCH] Usbcore: Do not disable USB3 protocol ports in hub_activate
> 
> When USB3 port detects an USB3.0 device attach, the port will
> automatically transition to the Enabled state upon the completion
> of successful link training.
> 
> Do not clear enable state for USB3 protocol port in hub_activate(),
> or USB3.0 device will fail to be recognized if xHCI bus power
> management is implemented.
> 
> Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
> ---
>  drivers/usb/core/hub.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 3dfeb4a..ce62218 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -710,7 +710,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
>  		 * Unconnected ports should likewise be disabled (paranoia),
>  		 * and so should ports for which we have no usb_device.
>  		 */
> -		if ((portstatus & USB_PORT_STAT_ENABLE) && (
> +		if ((portstatus & USB_PORT_STAT_ENABLE) &&
> +		    !(portstatus & (1 << USB_PORT_FEAT_SUPERSPEED)) && (

This can't be right.  There _is_ no SUPERSPEED feature; the macro
definition in hub.h is bogus.  (For that matter, there is no HIGHSPEED
feature either -- that ought to be cleaned up.)  Note that (1 <<
USB_PORT_FEAT_SUPERSPEED) is actually equal to USB_PORT_STAT_TEST --
which is certainly not what you want.

I'm not sure exactly what is the right thing to test here; certainly
you need to check whether the hub supports USB-3.0.  However it's not
clear exactly how external hubs will behave; the USB-3.0 spec says that
hubs are the only devices allowed to function at high-speed and
SuperSpeed at the same time, but it doesn't explain what that entails.

(I also noticed that the USB-3.0 spec says it's not possible to clear
the PORT_ENABLED feature at all; so it's not obvious how situations
like this should be handled.  Clearly the hub driver needs a lot more
updates to handle USB-3.0 hubs correctly.)

>  				type != HUB_RESUME ||
>  				!(portstatus & USB_PORT_STAT_CONNECTION) ||
>  				!udev ||

Although you included a good discussion in your patch description, you 
did not update the comment in the code.  People reading the code won't 
know what's going on.  Please update the comment to match the code.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux