On Tue, 21 Aug 2012, Lan Tianyu wrote:

> From: "Signed-off-by: Lan Tianyu" <[email protected]>

What happened here?  That's not right.

> ACPI provide "_PLD" and "_UPC" aml methods to describe usb port
> visibility and connectability. This patch is to use those information
> to set usb port's DeviceRemovable.

By the way, what tree are these patches based on?  None of the new 
hub-port stuff seems to be in Greg's USB tree yet.

> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 65c91300..4c631d3 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -1560,6 +1560,10 @@ static int hub_configure(struct usb_hub *hub,
>                       dev_err(hub->intfdev,
>                               "couldn't create port%d device.\n", i + 1);
>  
> +     /*  Get hub descripor again to sync port's DeviceRemovable
> +      *  after the usb port devices being created.
> +      */
> +     get_hub_descriptor(hdev, hub->descriptor);

Why is this needed?  Do you have any reason to think the hub descriptor 
has changed since the first time we retrieved it?


> diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
> index c788022..0a3bb05 100644
> --- a/drivers/usb/host/ehci-hub.c
> +++ b/drivers/usb/host/ehci-hub.c
> @@ -636,6 +636,7 @@ ehci_hub_descriptor (
>       struct usb_hub_descriptor       *desc
>  ) {
>       int             ports = HCS_N_PORTS (ehci->hcs_params);
> +     int             i;
>       u16             temp;
>  
>       desc->bDescriptorType = 0x29;
> @@ -648,7 +649,14 @@ ehci_hub_descriptor (
>  
>       /* two bitmaps:  ports removable, and usb 1.0 legacy PortPwrCtrlMask */
>       memset(&desc->u.hs.DeviceRemovable[0], 0, temp);
> -     memset(&desc->u.hs.DeviceRemovable[temp], 0xff, temp);
> +     memset(&desc->u.hs.DeviceRemovable[temp], 0xff, ltemp);

What is ltemp?  Did you really mean to change this line?

> +
> +     for (i = 1; i <= ports; i++) {
> +             if (usb_get_hub_port_connect_type(hcd->self.root_hub, i);
> +                             == USB_PORT_CONNECT_TYPE_HARD_WIRED)
> +                     desc->u.hs.DeviceRemovable[ports/8] |= 1 << (i%8);

You have "ports/8" where it should be "i/8".

> +     }
> +
>  
>       temp = 0x0008;                  /* per-port overcurrent reporting */
>       if (HCS_PPC (ehci->hcs_params))

Alan Stern

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

Reply via email to