ChangeSet 1.1608.24.7, 2004/02/26 14:09:37-08:00, [EMAIL PROTECTED]
[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
drivers/usb/host/uhci-hcd.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c Tue Mar 16 15:06:46 2004
+++ b/drivers/usb/host/uhci-hcd.c Tue Mar 16 15:06:46 2004
@@ -1852,17 +1852,12 @@
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);
}
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel