summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/usb-acpi.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2014-05-20 18:08:22 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-27 16:35:10 -0700
commita4204ff0bd576fc114357eed70e7c4e776ddf396 (patch)
tree9322cdeb51cd3b509dd3c2a68d17ccbdc1f6e46e /drivers/usb/core/usb-acpi.c
parentd99f6b41308779244662109a9c2bad09a82e8ac6 (diff)
downloadtalos-obmc-linux-a4204ff0bd576fc114357eed70e7c4e776ddf396.tar.gz
talos-obmc-linux-a4204ff0bd576fc114357eed70e7c4e776ddf396.zip
usb: cleanup setting udev->removable from port_dev->connect_type
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. Note, we no longer pass udev->portnum to acpi_find_child_device() in the root hub case since: 1/ the usb-core sets this to zero 2/ acpi always expects zero ...just pass zero. Suggested-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/usb-acpi.c')
-rw-r--r--drivers/usb/core/usb-acpi.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index f91ef0220066..d3e7e1b4125e 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -136,8 +136,8 @@ out:
static struct acpi_device *usb_acpi_find_companion(struct device *dev)
{
- int port1;
struct usb_device *udev;
+ struct acpi_device *adev;
acpi_handle *parent_handle;
/*
@@ -155,40 +155,18 @@ 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);
+ /* root hub is only child (_ADR=0) under its parent, the HC */
+ adev = ACPI_COMPANION(dev->parent);
+ return acpi_find_child_device(adev, 0, false);
} else if (is_usb_port(dev)) {
struct usb_port *port_dev = to_usb_port(dev);
- struct acpi_device *adev = NULL;
+ int port1 = port_dev->portnum;
/* Get the struct usb_device point of port's hub */
udev = to_usb_device(dev->parent->parent);
- port1 = port_dev->portnum;
/*
* The root hub ports' parent is the root hub. The non-root-hub
OpenPOWER on IntegriCloud