diff options
Diffstat (limited to 'drivers/usb/core/message.c')
| -rw-r--r-- | drivers/usb/core/message.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index bdd1c6749d88..0ab7da2283e3 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
| @@ -1174,6 +1174,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
| 1174 | put_device(&dev->actconfig->interface[i]->dev); | 1174 | put_device(&dev->actconfig->interface[i]->dev); |
| 1175 | dev->actconfig->interface[i] = NULL; | 1175 | dev->actconfig->interface[i] = NULL; |
| 1176 | } | 1176 | } |
| 1177 | usb_unlocked_disable_lpm(dev); | ||
| 1178 | usb_disable_ltm(dev); | ||
| 1177 | dev->actconfig = NULL; | 1179 | dev->actconfig = NULL; |
| 1178 | if (dev->state == USB_STATE_CONFIGURED) | 1180 | if (dev->state == USB_STATE_CONFIGURED) |
| 1179 | usb_set_device_state(dev, USB_STATE_ADDRESS); | 1181 | usb_set_device_state(dev, USB_STATE_ADDRESS); |
| @@ -1559,7 +1561,7 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 1559 | 1561 | ||
| 1560 | if (add_uevent_var(env, | 1562 | if (add_uevent_var(env, |
| 1561 | "MODALIAS=usb:" | 1563 | "MODALIAS=usb:" |
| 1562 | "v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", | 1564 | "v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02Xin%02X", |
| 1563 | le16_to_cpu(usb_dev->descriptor.idVendor), | 1565 | le16_to_cpu(usb_dev->descriptor.idVendor), |
| 1564 | le16_to_cpu(usb_dev->descriptor.idProduct), | 1566 | le16_to_cpu(usb_dev->descriptor.idProduct), |
| 1565 | le16_to_cpu(usb_dev->descriptor.bcdDevice), | 1567 | le16_to_cpu(usb_dev->descriptor.bcdDevice), |
| @@ -1568,7 +1570,8 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 1568 | usb_dev->descriptor.bDeviceProtocol, | 1570 | usb_dev->descriptor.bDeviceProtocol, |
| 1569 | alt->desc.bInterfaceClass, | 1571 | alt->desc.bInterfaceClass, |
| 1570 | alt->desc.bInterfaceSubClass, | 1572 | alt->desc.bInterfaceSubClass, |
| 1571 | alt->desc.bInterfaceProtocol)) | 1573 | alt->desc.bInterfaceProtocol, |
| 1574 | alt->desc.bInterfaceNumber)) | ||
| 1572 | return -ENOMEM; | 1575 | return -ENOMEM; |
| 1573 | 1576 | ||
| 1574 | return 0; | 1577 | return 0; |
| @@ -1791,14 +1794,15 @@ free_interfaces: | |||
| 1791 | * installed, so that the xHCI driver can recalculate the U1/U2 | 1794 | * installed, so that the xHCI driver can recalculate the U1/U2 |
| 1792 | * timeouts. | 1795 | * timeouts. |
| 1793 | */ | 1796 | */ |
| 1794 | if (usb_disable_lpm(dev)) { | 1797 | if (dev->actconfig && usb_disable_lpm(dev)) { |
| 1795 | dev_err(&dev->dev, "%s Failed to disable LPM\n.", __func__); | 1798 | dev_err(&dev->dev, "%s Failed to disable LPM\n.", __func__); |
| 1796 | mutex_unlock(hcd->bandwidth_mutex); | 1799 | mutex_unlock(hcd->bandwidth_mutex); |
| 1797 | return -ENOMEM; | 1800 | return -ENOMEM; |
| 1798 | } | 1801 | } |
| 1799 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); | 1802 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); |
| 1800 | if (ret < 0) { | 1803 | if (ret < 0) { |
| 1801 | usb_enable_lpm(dev); | 1804 | if (dev->actconfig) |
| 1805 | usb_enable_lpm(dev); | ||
| 1802 | mutex_unlock(hcd->bandwidth_mutex); | 1806 | mutex_unlock(hcd->bandwidth_mutex); |
| 1803 | usb_autosuspend_device(dev); | 1807 | usb_autosuspend_device(dev); |
| 1804 | goto free_interfaces; | 1808 | goto free_interfaces; |
| @@ -1818,7 +1822,7 @@ free_interfaces: | |||
| 1818 | if (!cp) { | 1822 | if (!cp) { |
| 1819 | usb_set_device_state(dev, USB_STATE_ADDRESS); | 1823 | usb_set_device_state(dev, USB_STATE_ADDRESS); |
| 1820 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | 1824 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
| 1821 | usb_enable_lpm(dev); | 1825 | /* Leave LPM disabled while the device is unconfigured. */ |
| 1822 | mutex_unlock(hcd->bandwidth_mutex); | 1826 | mutex_unlock(hcd->bandwidth_mutex); |
| 1823 | usb_autosuspend_device(dev); | 1827 | usb_autosuspend_device(dev); |
| 1824 | goto free_interfaces; | 1828 | goto free_interfaces; |
| @@ -1876,6 +1880,8 @@ free_interfaces: | |||
| 1876 | 1880 | ||
| 1877 | /* Now that the interfaces are installed, re-enable LPM. */ | 1881 | /* Now that the interfaces are installed, re-enable LPM. */ |
| 1878 | usb_unlocked_enable_lpm(dev); | 1882 | usb_unlocked_enable_lpm(dev); |
| 1883 | /* Enable LTM if it was turned off by usb_disable_device. */ | ||
| 1884 | usb_enable_ltm(dev); | ||
| 1879 | 1885 | ||
| 1880 | /* Now that all the interfaces are set up, register them | 1886 | /* Now that all the interfaces are set up, register them |
| 1881 | * to trigger binding of drivers to interfaces. probe() | 1887 | * to trigger binding of drivers to interfaces. probe() |
