Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 210222
b: refs/heads/master
c: 0791971
h: refs/heads/master
v: v3
  • Loading branch information
Thadeu Lima de Souza Cascardo authored and Greg Kroah-Hartman committed Sep 4, 2010
1 parent afa41ee commit bff62fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b22a32e76defeb573991b301a27d299472c5714
refs/heads/master: 0791971ba8fbc44e4f476079f856335ed45e6324
22 changes: 11 additions & 11 deletions trunk/drivers/usb/core/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,15 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
if (ret)
goto free_interfaces;

/* if it's already configured, clear out old state first.
* getting rid of old interfaces means unbinding their drivers.
*/
if (dev->state != USB_STATE_ADDRESS)
usb_disable_device(dev, 1); /* Skip ep0 */

/* Get rid of pending async Set-Config requests for this device */
cancel_async_set_config(dev);

/* Make sure we have bandwidth (and available HCD resources) for this
* configuration. Remove endpoints from the schedule if we're dropping
* this configuration to set configuration 0. After this point, the
Expand All @@ -1733,20 +1742,11 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
mutex_lock(&hcd->bandwidth_mutex);
ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL);
if (ret < 0) {
usb_autosuspend_device(dev);
mutex_unlock(&hcd->bandwidth_mutex);
usb_autosuspend_device(dev);
goto free_interfaces;
}

/* if it's already configured, clear out old state first.
* getting rid of old interfaces means unbinding their drivers.
*/
if (dev->state != USB_STATE_ADDRESS)
usb_disable_device(dev, 1); /* Skip ep0 */

/* Get rid of pending async Set-Config requests for this device */
cancel_async_set_config(dev);

ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
NULL, 0, USB_CTRL_SET_TIMEOUT);
Expand All @@ -1761,8 +1761,8 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
if (!cp) {
usb_set_device_state(dev, USB_STATE_ADDRESS);
usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
usb_autosuspend_device(dev);
mutex_unlock(&hcd->bandwidth_mutex);
usb_autosuspend_device(dev);
goto free_interfaces;
}
mutex_unlock(&hcd->bandwidth_mutex);
Expand Down

0 comments on commit bff62fc

Please sign in to comment.