summaryrefslogtreecommitdiff
path: root/drivers/usb/core/hub.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/hub.c
parentd99f6b41308779244662109a9c2bad09a82e8ac6 (diff)
downloadlwn-a4204ff0bd576fc114357eed70e7c4e776ddf396.tar.gz
lwn-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/hub.c')
-rw-r--r--drivers/usb/core/hub.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 653f80c52486..291292508774 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2305,6 +2305,22 @@ static void set_usb_port_removable(struct usb_device *udev)
udev->removable = USB_DEVICE_REMOVABLE;
else
udev->removable = USB_DEVICE_FIXED;
+
+ /*
+ * Platform firmware may have populated an alternative value for
+ * removable. If the parent port has a known connect_type use
+ * that instead.
+ */
+ switch (hub->ports[udev->portnum - 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: /* use what was set above */
+ break;
+ }
}
/**
@@ -2374,11 +2390,7 @@ int usb_new_device(struct usb_device *udev)
device_enable_async_suspend(&udev->dev);
- /*
- * check whether the hub marks this port as non-removable. Do it
- * now so that platform-specific data can override it in
- * device_add()
- */
+ /* check whether the hub or firmware marks this port as non-removable */
if (udev->parent)
set_usb_port_removable(udev);