Commit 56e695be authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] USB: Use list_splice instead of looping over list elements

This patch is from Stephen Hemminger.  I modified it slightly to place the
new elements at the end of the complete_list instead of at the front.

On Tue, 24 Feb 2004, Stephen Hemminger wrote:

> Since the remove_list and complete_list now use the same element for
> linking, it is possible to use the list_splice inline to avoid
> having to loop over all the urb's
parent c09f3a22
......@@ -1852,17 +1852,12 @@ static void uhci_finish_completion(struct usb_hcd *hcd, struct pt_regs *regs)
static void uhci_remove_pending_urbps(struct uhci_hcd *uhci)
{
struct list_head *tmp, *head;
spin_lock(&uhci->urb_remove_list_lock);
head = &uhci->urb_remove_list;
tmp = head->next;
while (tmp != head) {
struct urb_priv *urbp = list_entry(tmp, struct urb_priv, urb_list);
spin_lock(&uhci->complete_list_lock);
tmp = tmp->next;
uhci_moveto_complete(uhci, urbp);
}
/* Splice the urb_remove_list onto the end of the complete_list */
list_splice_init(&uhci->urb_remove_list, uhci->complete_list.prev);
spin_unlock(&uhci->complete_list_lock);
spin_unlock(&uhci->urb_remove_list_lock);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment