aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2008-12-18 03:17:49 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-07 13:00:11 -0500
commit856395d6e137b4e7194972cb7765f3de6a72ba61 (patch)
treef10166dcb6dd2a7df98542a18c8e01161e5a2caf
parent42c65396d4f10f25bdab13f8e2f33fe63fa94418 (diff)
USB: extension of anchor API to unpoison an anchor
This extension allows unpoisoning an anchor allowing drivers that resubmit URBs to reuse an anchor for methods like resume() Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/urb.c20
-rw-r--r--include/linux/usb.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index b5e9948698bf..58bc5e3c2560 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -679,6 +679,26 @@ void usb_poison_anchored_urbs(struct usb_anchor *anchor)
679EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs); 679EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
680 680
681/** 681/**
682 * usb_unpoison_anchored_urbs - let an anchor be used successfully again
683 * @anchor: anchor the requests are bound to
684 *
685 * Reverses the effect of usb_poison_anchored_urbs
686 * the anchor can be used normally after it returns
687 */
688void usb_unpoison_anchored_urbs(struct usb_anchor *anchor)
689{
690 unsigned long flags;
691 struct urb *lazarus;
692
693 spin_lock_irqsave(&anchor->lock, flags);
694 list_for_each_entry(lazarus, &anchor->urb_list, anchor_list) {
695 usb_unpoison_urb(lazarus);
696 }
697 anchor->poisoned = 0;
698 spin_unlock_irqrestore(&anchor->lock, flags);
699}
700EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs);
701/**
682 * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse 702 * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse
683 * @anchor: anchor the requests are bound to 703 * @anchor: anchor the requests are bound to
684 * 704 *
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 4e8654a18250..e89639896508 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1485,6 +1485,7 @@ extern void usb_poison_urb(struct urb *urb);
1485extern void usb_unpoison_urb(struct urb *urb); 1485extern void usb_unpoison_urb(struct urb *urb);
1486extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1486extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1487extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1487extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1488extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
1488extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1489extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1489extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1490extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1490extern void usb_unanchor_urb(struct urb *urb); 1491extern void usb_unanchor_urb(struct urb *urb);