~ubuntu-branches/ubuntu/precise/linux-lts-quantal/precise-updates

« back to all changes in this revision

Viewing changes to drivers/usb/core/message.c

  • Committer: Package Import Robot
  • Author(s): Luis Henriques, Luis Henriques, Tim Gardner
  • Date: 2013-02-07 12:08:38 UTC
  • Revision ID: package-import@ubuntu.com-20130207120838-8jaukepmb85dkevq
Tags: 3.5.0-24.37~precise1
[Luis Henriques]

* Release Tracking Bug
  - LP: #1118287

[ Tim Gardner ]

* [Config] CONFIG_ALX=m for x86 only
  - LP: #927782

Show diffs side-by-side

added added

removed removed

Lines of Context:
1807
1807
                goto free_interfaces;
1808
1808
        }
1809
1809
 
1810
 
        ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1811
 
                              USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
1812
 
                              NULL, 0, USB_CTRL_SET_TIMEOUT);
1813
 
        if (ret < 0) {
1814
 
                /* All the old state is gone, so what else can we do?
1815
 
                 * The device is probably useless now anyway.
1816
 
                 */
1817
 
                cp = NULL;
1818
 
        }
1819
 
 
1820
 
        dev->actconfig = cp;
1821
 
        if (!cp) {
1822
 
                usb_set_device_state(dev, USB_STATE_ADDRESS);
1823
 
                usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
1824
 
                /* Leave LPM disabled while the device is unconfigured. */
1825
 
                mutex_unlock(hcd->bandwidth_mutex);
1826
 
                usb_autosuspend_device(dev);
1827
 
                goto free_interfaces;
1828
 
        }
1829
 
        mutex_unlock(hcd->bandwidth_mutex);
1830
 
        usb_set_device_state(dev, USB_STATE_CONFIGURED);
1831
 
 
1832
 
        /* Initialize the new interface structures and the
 
1810
        /*
 
1811
         * Initialize the new interface structures and the
1833
1812
         * hc/hcd/usbcore interface/endpoint state.
1834
1813
         */
1835
1814
        for (i = 0; i < nintf; ++i) {
1873
1852
        }
1874
1853
        kfree(new_interfaces);
1875
1854
 
 
1855
        ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 
1856
                              USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
 
1857
                              NULL, 0, USB_CTRL_SET_TIMEOUT);
 
1858
        if (ret < 0 && cp) {
 
1859
                /*
 
1860
                 * All the old state is gone, so what else can we do?
 
1861
                 * The device is probably useless now anyway.
 
1862
                 */
 
1863
                usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
 
1864
                for (i = 0; i < nintf; ++i) {
 
1865
                        usb_disable_interface(dev, cp->interface[i], true);
 
1866
                        put_device(&cp->interface[i]->dev);
 
1867
                        cp->interface[i] = NULL;
 
1868
                }
 
1869
                cp = NULL;
 
1870
        }
 
1871
 
 
1872
        dev->actconfig = cp;
 
1873
        mutex_unlock(hcd->bandwidth_mutex);
 
1874
 
 
1875
        if (!cp) {
 
1876
                usb_set_device_state(dev, USB_STATE_ADDRESS);
 
1877
 
 
1878
                /* Leave LPM disabled while the device is unconfigured. */
 
1879
                usb_autosuspend_device(dev);
 
1880
                return ret;
 
1881
        }
 
1882
        usb_set_device_state(dev, USB_STATE_CONFIGURED);
 
1883
 
1876
1884
        if (cp->string == NULL &&
1877
1885
                        !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS))
1878
1886
                cp->string = usb_cache_string(dev, cp->desc.iConfiguration);