On Fri, 28 Feb 2014, Dan Williams wrote:

> Once usb-acpi has set the port's connect type the usb_device's
> ->removable attribute can be set in the standard location
> set_usb_port_removable().
> 
> This also changes behavior in the case where the firmware says that the
> port connect type is unknown.  In that case just use the default setting
> determined from the hub descriptor.
> 
> Suggested-by: Alan Stern <[email protected]>
> Signed-off-by: Dan Williams <[email protected]>

Good clean-up.

> @@ -155,36 +156,15 @@ static struct acpi_device 
> *usb_acpi_find_companion(struct device *dev)
>        */
>       if (is_usb_device(dev)) {
>               udev = to_usb_device(dev);
> -             port1 = udev->portnum;
> -             if (udev->parent) {
> -                     struct usb_hub *hub;
> -
> -                     hub = usb_hub_to_struct_hub(udev->parent);
> -                     /*
> -                      * According usb port's connect type to set usb device's
> -                      * removability.
> -                      */
> -                     switch (hub->ports[port1 - 1]->connect_type) {
> -                     case USB_PORT_CONNECT_TYPE_HOT_PLUG:
> -                             udev->removable = USB_DEVICE_REMOVABLE;
> -                             break;
> -                     case USB_PORT_CONNECT_TYPE_HARD_WIRED:
> -                             udev->removable = USB_DEVICE_FIXED;
> -                             break;
> -                     default:
> -                             udev->removable = USB_DEVICE_REMOVABLE_UNKNOWN;
> -                             break;
> -                     }
> -
> +             if (udev->parent)
>                       return NULL;
> -             }
>  
>               /* root hub's parent is the usb hcd. */
> -             return acpi_find_child_device(ACPI_COMPANION(dev->parent),
> -                             port1, false);
> +             port1 = udev->portnum;
> +             adev = ACPI_COMPANION(dev->parent);
> +             return acpi_find_child_device(adev, port1, false);

Does this entirely make sense?  As far as I can see, port1 is never
going to be anything other than 0.  After all, root hubs don't have
upstream ports.  I don't know what ACPI expects to see here.

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