USB: extension of anchor API to unpoison an anchor
authorOliver Neukum <oliver@neukum.org>
Thu, 18 Dec 2008 08:17:49 +0000 (09:17 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 7 Jan 2009 18:00:11 +0000 (10:00 -0800)
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>
drivers/usb/core/urb.c
include/linux/usb.h

index b5e9948698bfcdbc20bc0f7f93e293069d04272d..58bc5e3c25603dcaf2cf073c85012006b61b6545 100644 (file)
@@ -678,6 +678,26 @@ void usb_poison_anchored_urbs(struct usb_anchor *anchor)
 }
 EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
 
+/**
+ * usb_unpoison_anchored_urbs - let an anchor be used successfully again
+ * @anchor: anchor the requests are bound to
+ *
+ * Reverses the effect of usb_poison_anchored_urbs
+ * the anchor can be used normally after it returns
+ */
+void usb_unpoison_anchored_urbs(struct usb_anchor *anchor)
+{
+       unsigned long flags;
+       struct urb *lazarus;
+
+       spin_lock_irqsave(&anchor->lock, flags);
+       list_for_each_entry(lazarus, &anchor->urb_list, anchor_list) {
+               usb_unpoison_urb(lazarus);
+       }
+       anchor->poisoned = 0;
+       spin_unlock_irqrestore(&anchor->lock, flags);
+}
+EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs);
 /**
  * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse
  * @anchor: anchor the requests are bound to
index 4e8654a182507b773ac1f604b27fcce4bfde146e..e896398965084188a3861afcf2c8b38dac346a20 100644 (file)
@@ -1485,6 +1485,7 @@ extern void usb_poison_urb(struct urb *urb);
 extern void usb_unpoison_urb(struct urb *urb);
 extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
 extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
+extern void usb_unpoison_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);