--- hub.c.orig 2014-08-04 00:25:02.000000000 +0200 +++ hub.c 2014-09-09 11:56:24.721312469 +0200 @@ -820,6 +820,8 @@ EXPORT_SYMBOL_GPL(usb_hub_clear_tt_buffe static void hub_power_on(struct usb_hub *hub, bool do_delay) { int port1; + u16 wHubCharacteristics = + le16_to_cpu(hub->descriptor->wHubCharacteristics); /* Enable power on each port. Some hubs have reserved values * of LPSM (> 2) in their descriptors, even though they are @@ -827,7 +829,7 @@ static void hub_power_on(struct usb_hub * but only emulate it. In all cases, the ports won't work * unless we send these messages to the hub. */ - if (hub_is_port_power_switchable(hub)) + if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2) dev_dbg(hub->intfdev, "enabling power on all ports\n"); else dev_dbg(hub->intfdev, "trying to enable port power on " @@ -4548,6 +4550,8 @@ static void hub_port_connect(struct usb_ unsigned unit_load; struct usb_device *hdev = hub->hdev; struct usb_hcd *hcd = bus_to_hcd(hdev->bus); + unsigned wHubCharacteristics = + le16_to_cpu(hub->descriptor->wHubCharacteristics); struct usb_port *port_dev = hub->ports[port1 - 1]; struct usb_device *udev = port_dev->child; @@ -4586,7 +4590,7 @@ static void hub_port_connect(struct usb_ test_bit(port1, hub->removed_bits)) { /* maybe switch power back on (e.g. root hub was reset) */ - if (hub_is_port_power_switchable(hub) + if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2 && !port_is_power_on(hub, portstatus)) set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); --- hub.h.orig 2014-08-04 00:25:02.000000000 +0200 +++ hub.h 2014-09-09 12:52:40.027903791 +0200 @@ -119,16 +119,6 @@ extern int hub_port_debounce(struct usb_ extern int usb_clear_port_feature(struct usb_device *hdev, int port1, int feature); -static inline bool hub_is_port_power_switchable(struct usb_hub *hub) -{ - __le16 hcs; - - if (!hub) - return false; - hcs = hub->descriptor->wHubCharacteristics; - return (le16_to_cpu(hcs) & HUB_CHAR_LPSM) < HUB_CHAR_NO_LPSM; -} - static inline int hub_is_superspeed(struct usb_device *hdev) { return hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS; --- port.c.orig 2014-08-04 00:25:02.000000000 +0200 +++ port.c 2014-09-09 12:58:46.521229430 +0200 @@ -445,16 +445,11 @@ int usb_hub_create_port_device(struct us */ pm_runtime_set_active(&port_dev->dev); pm_runtime_get_noresume(&port_dev->dev); - pm_runtime_enable(&port_dev->dev); + if (!dev_pm_qos_expose_flags(&port_dev->dev, + PM_QOS_FLAG_NO_POWER_OFF)) + pm_runtime_enable(&port_dev->dev); device_enable_async_suspend(&port_dev->dev); - /* - * Keep hidden the ability to enable port-poweroff if the hub - * does not support power switching. - */ - if (!hub_is_port_power_switchable(hub)) - return 0; - /* Attempt to let userspace take over the policy. */ retval = dev_pm_qos_expose_flags(&port_dev->dev, PM_QOS_FLAG_NO_POWER_OFF);