X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fusb%2Fcore%2Furb.c;h=47111e88f791ad748956d4cbae7317145cfd8927;hb=d26acd92fa990764b72608a68224f46fac377032;hp=9d7e63292c01175647503b65e821cdd3b94dc381;hpb=215e871aaa3d94540121a3809d80d0c5e5686e4f;p=linux-2.6 diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 9d7e63292c..47111e88f7 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -334,7 +334,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) dev_dbg(&dev->dev, "bogus endpoint ep%d%s in %s (bad maxpacket %d)\n", usb_endpoint_num(&ep->desc), is_out ? "out" : "in", - __FUNCTION__, max); + __func__, max); return -EMSGSIZE; } @@ -589,6 +589,35 @@ void usb_kill_anchored_urbs(struct usb_anchor *anchor) } EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs); +/** + * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse + * @anchor: anchor the requests are bound to + * + * this allows all outstanding URBs to be unlinked starting + * from the back of the queue. This function is asynchronous. + * The unlinking is just tiggered. It may happen after this + * function has returned. + */ +void usb_unlink_anchored_urbs(struct usb_anchor *anchor) +{ + struct urb *victim; + unsigned long flags; + + spin_lock_irqsave(&anchor->lock, flags); + while (!list_empty(&anchor->urb_list)) { + victim = list_entry(anchor->urb_list.prev, struct urb, + anchor_list); + usb_get_urb(victim); + spin_unlock_irqrestore(&anchor->lock, flags); + /* this will unanchor the URB */ + usb_unlink_urb(victim); + usb_put_urb(victim); + spin_lock_irqsave(&anchor->lock, flags); + } + spin_unlock_irqrestore(&anchor->lock, flags); +} +EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); + /** * usb_wait_anchor_empty_timeout - wait for an anchor to be unused * @anchor: the anchor you want to become unused