diff options
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r-- | drivers/usb/core/message.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 1ed5afd91e6d..131f73649b60 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1540,7 +1540,6 @@ static void usb_release_interface(struct device *dev) | |||
1540 | kfree(intf); | 1540 | kfree(intf); |
1541 | } | 1541 | } |
1542 | 1542 | ||
1543 | #ifdef CONFIG_HOTPLUG | ||
1544 | static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) | 1543 | static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) |
1545 | { | 1544 | { |
1546 | struct usb_device *usb_dev; | 1545 | struct usb_device *usb_dev; |
@@ -1575,14 +1574,6 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
1575 | return 0; | 1574 | return 0; |
1576 | } | 1575 | } |
1577 | 1576 | ||
1578 | #else | ||
1579 | |||
1580 | static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
1581 | { | ||
1582 | return -ENODEV; | ||
1583 | } | ||
1584 | #endif /* CONFIG_HOTPLUG */ | ||
1585 | |||
1586 | struct device_type usb_if_device_type = { | 1577 | struct device_type usb_if_device_type = { |
1587 | .name = "usb_interface", | 1578 | .name = "usb_interface", |
1588 | .release = usb_release_interface, | 1579 | .release = usb_release_interface, |
@@ -1795,7 +1786,8 @@ free_interfaces: | |||
1795 | if (dev->actconfig && usb_disable_lpm(dev)) { | 1786 | if (dev->actconfig && usb_disable_lpm(dev)) { |
1796 | dev_err(&dev->dev, "%s Failed to disable LPM\n.", __func__); | 1787 | dev_err(&dev->dev, "%s Failed to disable LPM\n.", __func__); |
1797 | mutex_unlock(hcd->bandwidth_mutex); | 1788 | mutex_unlock(hcd->bandwidth_mutex); |
1798 | return -ENOMEM; | 1789 | ret = -ENOMEM; |
1790 | goto free_interfaces; | ||
1799 | } | 1791 | } |
1800 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); | 1792 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); |
1801 | if (ret < 0) { | 1793 | if (ret < 0) { |
@@ -1806,29 +1798,8 @@ free_interfaces: | |||
1806 | goto free_interfaces; | 1798 | goto free_interfaces; |
1807 | } | 1799 | } |
1808 | 1800 | ||
1809 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 1801 | /* |
1810 | USB_REQ_SET_CONFIGURATION, 0, configuration, 0, | 1802 | * Initialize the new interface structures and the |
1811 | NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
1812 | if (ret < 0) { | ||
1813 | /* All the old state is gone, so what else can we do? | ||
1814 | * The device is probably useless now anyway. | ||
1815 | */ | ||
1816 | cp = NULL; | ||
1817 | } | ||
1818 | |||
1819 | dev->actconfig = cp; | ||
1820 | if (!cp) { | ||
1821 | usb_set_device_state(dev, USB_STATE_ADDRESS); | ||
1822 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | ||
1823 | /* Leave LPM disabled while the device is unconfigured. */ | ||
1824 | mutex_unlock(hcd->bandwidth_mutex); | ||
1825 | usb_autosuspend_device(dev); | ||
1826 | goto free_interfaces; | ||
1827 | } | ||
1828 | mutex_unlock(hcd->bandwidth_mutex); | ||
1829 | usb_set_device_state(dev, USB_STATE_CONFIGURED); | ||
1830 | |||
1831 | /* Initialize the new interface structures and the | ||
1832 | * hc/hcd/usbcore interface/endpoint state. | 1803 | * hc/hcd/usbcore interface/endpoint state. |
1833 | */ | 1804 | */ |
1834 | for (i = 0; i < nintf; ++i) { | 1805 | for (i = 0; i < nintf; ++i) { |
@@ -1872,6 +1843,35 @@ free_interfaces: | |||
1872 | } | 1843 | } |
1873 | kfree(new_interfaces); | 1844 | kfree(new_interfaces); |
1874 | 1845 | ||
1846 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | ||
1847 | USB_REQ_SET_CONFIGURATION, 0, configuration, 0, | ||
1848 | NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
1849 | if (ret < 0 && cp) { | ||
1850 | /* | ||
1851 | * All the old state is gone, so what else can we do? | ||
1852 | * The device is probably useless now anyway. | ||
1853 | */ | ||
1854 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | ||
1855 | for (i = 0; i < nintf; ++i) { | ||
1856 | usb_disable_interface(dev, cp->interface[i], true); | ||
1857 | put_device(&cp->interface[i]->dev); | ||
1858 | cp->interface[i] = NULL; | ||
1859 | } | ||
1860 | cp = NULL; | ||
1861 | } | ||
1862 | |||
1863 | dev->actconfig = cp; | ||
1864 | mutex_unlock(hcd->bandwidth_mutex); | ||
1865 | |||
1866 | if (!cp) { | ||
1867 | usb_set_device_state(dev, USB_STATE_ADDRESS); | ||
1868 | |||
1869 | /* Leave LPM disabled while the device is unconfigured. */ | ||
1870 | usb_autosuspend_device(dev); | ||
1871 | return ret; | ||
1872 | } | ||
1873 | usb_set_device_state(dev, USB_STATE_CONFIGURED); | ||
1874 | |||
1875 | if (cp->string == NULL && | 1875 | if (cp->string == NULL && |
1876 | !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) | 1876 | !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) |
1877 | cp->string = usb_cache_string(dev, cp->desc.iConfiguration); | 1877 | cp->string = usb_cache_string(dev, cp->desc.iConfiguration); |