• Home
  • Raw
  • Download

Lines Matching refs:anchor

124 void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor)  in usb_anchor_urb()  argument
128 spin_lock_irqsave(&anchor->lock, flags); in usb_anchor_urb()
130 list_add_tail(&urb->anchor_list, &anchor->urb_list); in usb_anchor_urb()
131 urb->anchor = anchor; in usb_anchor_urb()
133 if (unlikely(anchor->poisoned)) in usb_anchor_urb()
136 spin_unlock_irqrestore(&anchor->lock, flags); in usb_anchor_urb()
140 static int usb_anchor_check_wakeup(struct usb_anchor *anchor) in usb_anchor_check_wakeup() argument
142 return atomic_read(&anchor->suspend_wakeups) == 0 && in usb_anchor_check_wakeup()
143 list_empty(&anchor->urb_list); in usb_anchor_check_wakeup()
147 static void __usb_unanchor_urb(struct urb *urb, struct usb_anchor *anchor) in __usb_unanchor_urb() argument
149 urb->anchor = NULL; in __usb_unanchor_urb()
152 if (usb_anchor_check_wakeup(anchor)) in __usb_unanchor_urb()
153 wake_up(&anchor->wait); in __usb_unanchor_urb()
165 struct usb_anchor *anchor; in usb_unanchor_urb() local
170 anchor = urb->anchor; in usb_unanchor_urb()
171 if (!anchor) in usb_unanchor_urb()
174 spin_lock_irqsave(&anchor->lock, flags); in usb_unanchor_urb()
180 if (likely(anchor == urb->anchor)) in usb_unanchor_urb()
181 __usb_unanchor_urb(urb, anchor); in usb_unanchor_urb()
182 spin_unlock_irqrestore(&anchor->lock, flags); in usb_unanchor_urb()
792 void usb_kill_anchored_urbs(struct usb_anchor *anchor) in usb_kill_anchored_urbs() argument
798 spin_lock_irq(&anchor->lock); in usb_kill_anchored_urbs()
799 while (!list_empty(&anchor->urb_list)) { in usb_kill_anchored_urbs()
800 victim = list_entry(anchor->urb_list.prev, in usb_kill_anchored_urbs()
804 spin_unlock_irq(&anchor->lock); in usb_kill_anchored_urbs()
808 spin_lock_irq(&anchor->lock); in usb_kill_anchored_urbs()
810 surely_empty = usb_anchor_check_wakeup(anchor); in usb_kill_anchored_urbs()
812 spin_unlock_irq(&anchor->lock); in usb_kill_anchored_urbs()
830 void usb_poison_anchored_urbs(struct usb_anchor *anchor) in usb_poison_anchored_urbs() argument
836 spin_lock_irq(&anchor->lock); in usb_poison_anchored_urbs()
837 anchor->poisoned = 1; in usb_poison_anchored_urbs()
838 while (!list_empty(&anchor->urb_list)) { in usb_poison_anchored_urbs()
839 victim = list_entry(anchor->urb_list.prev, in usb_poison_anchored_urbs()
843 spin_unlock_irq(&anchor->lock); in usb_poison_anchored_urbs()
847 spin_lock_irq(&anchor->lock); in usb_poison_anchored_urbs()
849 surely_empty = usb_anchor_check_wakeup(anchor); in usb_poison_anchored_urbs()
851 spin_unlock_irq(&anchor->lock); in usb_poison_anchored_urbs()
864 void usb_unpoison_anchored_urbs(struct usb_anchor *anchor) in usb_unpoison_anchored_urbs() argument
869 spin_lock_irqsave(&anchor->lock, flags); in usb_unpoison_anchored_urbs()
870 list_for_each_entry(lazarus, &anchor->urb_list, anchor_list) { in usb_unpoison_anchored_urbs()
873 anchor->poisoned = 0; in usb_unpoison_anchored_urbs()
874 spin_unlock_irqrestore(&anchor->lock, flags); in usb_unpoison_anchored_urbs()
889 void usb_unlink_anchored_urbs(struct usb_anchor *anchor) in usb_unlink_anchored_urbs() argument
893 while ((victim = usb_get_from_anchor(anchor)) != NULL) { in usb_unlink_anchored_urbs()
908 void usb_anchor_suspend_wakeups(struct usb_anchor *anchor) in usb_anchor_suspend_wakeups() argument
910 if (anchor) in usb_anchor_suspend_wakeups()
911 atomic_inc(&anchor->suspend_wakeups); in usb_anchor_suspend_wakeups()
922 void usb_anchor_resume_wakeups(struct usb_anchor *anchor) in usb_anchor_resume_wakeups() argument
924 if (!anchor) in usb_anchor_resume_wakeups()
927 atomic_dec(&anchor->suspend_wakeups); in usb_anchor_resume_wakeups()
928 if (usb_anchor_check_wakeup(anchor)) in usb_anchor_resume_wakeups()
929 wake_up(&anchor->wait); in usb_anchor_resume_wakeups()
943 int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, in usb_wait_anchor_empty_timeout() argument
946 return wait_event_timeout(anchor->wait, in usb_wait_anchor_empty_timeout()
947 usb_anchor_check_wakeup(anchor), in usb_wait_anchor_empty_timeout()
962 struct urb *usb_get_from_anchor(struct usb_anchor *anchor) in usb_get_from_anchor() argument
967 spin_lock_irqsave(&anchor->lock, flags); in usb_get_from_anchor()
968 if (!list_empty(&anchor->urb_list)) { in usb_get_from_anchor()
969 victim = list_entry(anchor->urb_list.next, struct urb, in usb_get_from_anchor()
972 __usb_unanchor_urb(victim, anchor); in usb_get_from_anchor()
976 spin_unlock_irqrestore(&anchor->lock, flags); in usb_get_from_anchor()
989 void usb_scuttle_anchored_urbs(struct usb_anchor *anchor) in usb_scuttle_anchored_urbs() argument
996 spin_lock_irqsave(&anchor->lock, flags); in usb_scuttle_anchored_urbs()
997 while (!list_empty(&anchor->urb_list)) { in usb_scuttle_anchored_urbs()
998 victim = list_entry(anchor->urb_list.prev, in usb_scuttle_anchored_urbs()
1000 __usb_unanchor_urb(victim, anchor); in usb_scuttle_anchored_urbs()
1002 surely_empty = usb_anchor_check_wakeup(anchor); in usb_scuttle_anchored_urbs()
1004 spin_unlock_irqrestore(&anchor->lock, flags); in usb_scuttle_anchored_urbs()
1017 int usb_anchor_empty(struct usb_anchor *anchor) in usb_anchor_empty() argument
1019 return list_empty(&anchor->urb_list); in usb_anchor_empty()