diff options
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r-- | drivers/usb/core/message.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index b3bdfede45e..ca717da3be9 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -308,7 +308,8 @@ static void sg_complete(struct urb *urb) | |||
308 | retval = usb_unlink_urb(io->urbs [i]); | 308 | retval = usb_unlink_urb(io->urbs [i]); |
309 | if (retval != -EINPROGRESS && | 309 | if (retval != -EINPROGRESS && |
310 | retval != -ENODEV && | 310 | retval != -ENODEV && |
311 | retval != -EBUSY) | 311 | retval != -EBUSY && |
312 | retval != -EIDRM) | ||
312 | dev_err(&io->dev->dev, | 313 | dev_err(&io->dev->dev, |
313 | "%s, unlink --> %d\n", | 314 | "%s, unlink --> %d\n", |
314 | __func__, retval); | 315 | __func__, retval); |
@@ -317,7 +318,6 @@ static void sg_complete(struct urb *urb) | |||
317 | } | 318 | } |
318 | spin_lock(&io->lock); | 319 | spin_lock(&io->lock); |
319 | } | 320 | } |
320 | urb->dev = NULL; | ||
321 | 321 | ||
322 | /* on the last completion, signal usb_sg_wait() */ | 322 | /* on the last completion, signal usb_sg_wait() */ |
323 | io->bytes += urb->actual_length; | 323 | io->bytes += urb->actual_length; |
@@ -524,7 +524,6 @@ void usb_sg_wait(struct usb_sg_request *io) | |||
524 | case -ENXIO: /* hc didn't queue this one */ | 524 | case -ENXIO: /* hc didn't queue this one */ |
525 | case -EAGAIN: | 525 | case -EAGAIN: |
526 | case -ENOMEM: | 526 | case -ENOMEM: |
527 | io->urbs[i]->dev = NULL; | ||
528 | retval = 0; | 527 | retval = 0; |
529 | yield(); | 528 | yield(); |
530 | break; | 529 | break; |
@@ -542,7 +541,6 @@ void usb_sg_wait(struct usb_sg_request *io) | |||
542 | 541 | ||
543 | /* fail any uncompleted urbs */ | 542 | /* fail any uncompleted urbs */ |
544 | default: | 543 | default: |
545 | io->urbs[i]->dev = NULL; | ||
546 | io->urbs[i]->status = retval; | 544 | io->urbs[i]->status = retval; |
547 | dev_dbg(&io->dev->dev, "%s, submit --> %d\n", | 545 | dev_dbg(&io->dev->dev, "%s, submit --> %d\n", |
548 | __func__, retval); | 546 | __func__, retval); |
@@ -593,7 +591,10 @@ void usb_sg_cancel(struct usb_sg_request *io) | |||
593 | if (!io->urbs [i]->dev) | 591 | if (!io->urbs [i]->dev) |
594 | continue; | 592 | continue; |
595 | retval = usb_unlink_urb(io->urbs [i]); | 593 | retval = usb_unlink_urb(io->urbs [i]); |
596 | if (retval != -EINPROGRESS && retval != -EBUSY) | 594 | if (retval != -EINPROGRESS |
595 | && retval != -ENODEV | ||
596 | && retval != -EBUSY | ||
597 | && retval != -EIDRM) | ||
597 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", | 598 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", |
598 | __func__, retval); | 599 | __func__, retval); |
599 | } | 600 | } |
@@ -1135,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, | |||
1135 | * Deallocates hcd/hardware state for the endpoints (nuking all or most | 1136 | * Deallocates hcd/hardware state for the endpoints (nuking all or most |
1136 | * pending urbs) and usbcore state for the interfaces, so that usbcore | 1137 | * pending urbs) and usbcore state for the interfaces, so that usbcore |
1137 | * must usb_set_configuration() before any interfaces could be used. | 1138 | * must usb_set_configuration() before any interfaces could be used. |
1138 | * | ||
1139 | * Must be called with hcd->bandwidth_mutex held. | ||
1140 | */ | 1139 | */ |
1141 | void usb_disable_device(struct usb_device *dev, int skip_ep0) | 1140 | void usb_disable_device(struct usb_device *dev, int skip_ep0) |
1142 | { | 1141 | { |
@@ -1189,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1189 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); | 1188 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); |
1190 | } | 1189 | } |
1191 | /* Remove endpoints from the host controller internal state */ | 1190 | /* Remove endpoints from the host controller internal state */ |
1191 | mutex_lock(hcd->bandwidth_mutex); | ||
1192 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | 1192 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
1193 | mutex_unlock(hcd->bandwidth_mutex); | ||
1193 | /* Second pass: remove endpoint pointers */ | 1194 | /* Second pass: remove endpoint pointers */ |
1194 | } | 1195 | } |
1195 | for (i = skip_ep0; i < 16; ++i) { | 1196 | for (i = skip_ep0; i < 16; ++i) { |
@@ -1749,7 +1750,6 @@ free_interfaces: | |||
1749 | /* if it's already configured, clear out old state first. | 1750 | /* if it's already configured, clear out old state first. |
1750 | * getting rid of old interfaces means unbinding their drivers. | 1751 | * getting rid of old interfaces means unbinding their drivers. |
1751 | */ | 1752 | */ |
1752 | mutex_lock(hcd->bandwidth_mutex); | ||
1753 | if (dev->state != USB_STATE_ADDRESS) | 1753 | if (dev->state != USB_STATE_ADDRESS) |
1754 | usb_disable_device(dev, 1); /* Skip ep0 */ | 1754 | usb_disable_device(dev, 1); /* Skip ep0 */ |
1755 | 1755 | ||
@@ -1762,6 +1762,7 @@ free_interfaces: | |||
1762 | * host controller will not allow submissions to dropped endpoints. If | 1762 | * host controller will not allow submissions to dropped endpoints. If |
1763 | * this call fails, the device state is unchanged. | 1763 | * this call fails, the device state is unchanged. |
1764 | */ | 1764 | */ |
1765 | mutex_lock(hcd->bandwidth_mutex); | ||
1765 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); | 1766 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); |
1766 | if (ret < 0) { | 1767 | if (ret < 0) { |
1767 | mutex_unlock(hcd->bandwidth_mutex); | 1768 | mutex_unlock(hcd->bandwidth_mutex); |