<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">ChangeSet 1.1504.2.9, 2003/12/08 16:54:38-08:00, stern@rowland.harvard.edu

[PATCH] USB: khubd optimization

It changes spin_lock_save() to spin_lock() within the completion routine
and list_del()/INIT_LIST_HEAD() to list_del_init().  It's nothing more
than a minor optimization.


 drivers/usb/core/hub.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)


diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Mon Dec 29 14:26:01 2003
+++ b/drivers/usb/core/hub.c	Mon Dec 29 14:26:01 2003
@@ -126,7 +126,6 @@
 static void hub_irq(struct urb *urb, struct pt_regs *regs)
 {
 	struct usb_hub *hub = (struct usb_hub *)urb-&gt;context;
-	unsigned long flags;
 	int status;
 
 	switch (urb-&gt;status) {
@@ -151,12 +150,12 @@
 	hub-&gt;nerrors = 0;
 
 	/* Something happened, let khubd figure it out */
-	spin_lock_irqsave(&amp;hub_event_lock, flags);
+	spin_lock(&amp;hub_event_lock);
 	if (list_empty(&amp;hub-&gt;event_list)) {
 		list_add(&amp;hub-&gt;event_list, &amp;hub_event_list);
 		wake_up(&amp;khubd_wait);
 	}
-	spin_unlock_irqrestore(&amp;hub_event_lock, flags);
+	spin_unlock(&amp;hub_event_lock);
 
 resubmit:
 	if ((status = usb_submit_urb (hub-&gt;urb, GFP_ATOMIC)) != 0
@@ -494,10 +493,8 @@
 	spin_lock_irqsave(&amp;hub_event_lock, flags);
 
 	/* Delete it and then reset it */
-	list_del(&amp;hub-&gt;event_list);
-	INIT_LIST_HEAD(&amp;hub-&gt;event_list);
-	list_del(&amp;hub-&gt;hub_list);
-	INIT_LIST_HEAD(&amp;hub-&gt;hub_list);
+	list_del_init(&amp;hub-&gt;event_list);
+	list_del_init(&amp;hub-&gt;hub_list);
 
 	spin_unlock_irqrestore(&amp;hub_event_lock, flags);
 
</pre></body></html>