From 9c8f3da69167f77e2e6b0814dbe6b257f2b9265a Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Thu, 10 Apr 2008 14:07:37 +0200 Subject: [PATCH] --- yaml --- r: 93354 b: refs/heads/master c: eda769593bbae8aee4e336b0732f6016353301a3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/usb/core/urb.c | 24 ++++++++++++++++++++++++ trunk/include/linux/usb.h | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index b81a6e673b9b..0d7b23d82708 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9424ea29658ce5bcdcf527ddf9617b9507ddf1aa +refs/heads/master: eda769593bbae8aee4e336b0732f6016353301a3 diff --git a/trunk/drivers/usb/core/urb.c b/trunk/drivers/usb/core/urb.c index 9d7e63292c01..1d3ed1322fbe 100644 --- a/trunk/drivers/usb/core/urb.c +++ b/trunk/drivers/usb/core/urb.c @@ -589,6 +589,30 @@ 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; + + spin_lock_irq(&anchor->lock); + while (!list_empty(&anchor->urb_list)) { + victim = list_entry(anchor->urb_list.prev, struct urb, + anchor_list); + /* this will unanchor the URB */ + usb_unlink_urb(victim); + } + spin_unlock_irq(&anchor->lock); +} +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 diff --git a/trunk/include/linux/usb.h b/trunk/include/linux/usb.h index dd9733cc0ac2..52c449e4bdcd 100644 --- a/trunk/include/linux/usb.h +++ b/trunk/include/linux/usb.h @@ -1451,6 +1451,7 @@ extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); extern int usb_unlink_urb(struct urb *urb); extern void usb_kill_urb(struct urb *urb); extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); +extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); extern void usb_unanchor_urb(struct urb *urb); extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,