<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">ChangeSet 1.1722.83.11, 2004/06/02 14:06:55-07:00, stern@rowland.harvard.edu

[PATCH] USB: Minor cleanups for hub driver

Greg:

This patch takes care of some small miscellaneous items in hub.c:

	Move the definition of CONFIG to the right place;

	Print the proper value for submission status in the error log;

	Remove an unused list of all hubs;

	Remove some unneeded braces;

	Kill an accidentally-resurrected comment.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;greg@kroah.com&gt;


 drivers/usb/core/hub.c |   34 +++++++++-------------------------
 drivers/usb/core/hub.h |    1 -
 2 files changed, 9 insertions(+), 26 deletions(-)


diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Fri Jun 18 11:05:28 2004
+++ b/drivers/usb/core/hub.c	Fri Jun 18 11:05:28 2004
@@ -9,6 +9,11 @@
  */
 
 #include &lt;linux/config.h&gt;
+#ifdef CONFIG_USB_DEBUG
+	#define DEBUG
+#else
+	#undef DEBUG
+#endif
 #include &lt;linux/kernel.h&gt;
 #include &lt;linux/errno.h&gt;
 #include &lt;linux/module.h&gt;
@@ -19,11 +24,6 @@
 #include &lt;linux/slab.h&gt;
 #include &lt;linux/smp_lock.h&gt;
 #include &lt;linux/ioctl.h&gt;
-#ifdef CONFIG_USB_DEBUG
-	#define DEBUG
-#else
-	#undef DEBUG
-#endif
 #include &lt;linux/usb.h&gt;
 #include &lt;linux/usbdevice_fs.h&gt;
 #include &lt;linux/suspend.h&gt;
@@ -40,7 +40,6 @@
 static spinlock_t hub_event_lock = SPIN_LOCK_UNLOCKED;
 
 static LIST_HEAD(hub_event_list);	/* List of hubs needing servicing */
-static LIST_HEAD(hub_list);		/* List of all hubs (for cleanup) */
 
 static DECLARE_WAIT_QUEUE_HEAD(khubd_wait);
 static pid_t khubd_pid = 0;			/* PID of khubd */
@@ -268,7 +267,7 @@
 	if ((status = usb_submit_urb (hub-&gt;urb, GFP_ATOMIC)) != 0
 			/* ENODEV means we raced disconnect() */
 			&amp;&amp; status != -ENODEV)
-		dev_err (&amp;hub-&gt;intf-&gt;dev, "resubmit --&gt; %d\n", urb-&gt;status);
+		dev_err (&amp;hub-&gt;intf-&gt;dev, "resubmit --&gt; %d\n", status);
 	if (status == 0)
 		hub-&gt;urb_active = 1;
 done:
@@ -646,7 +645,6 @@
 
 	/* Delete it and then reset it */
 	list_del_init(&amp;hub-&gt;event_list);
-	list_del_init(&amp;hub-&gt;hub_list);
 
 	spin_unlock_irqrestore(&amp;hub_event_lock, flags);
 
@@ -695,7 +693,6 @@
 	struct usb_device *hdev;
 	struct usb_hub *hub;
 	struct device *hub_dev;
-	unsigned long flags;
 
 	desc = intf-&gt;cur_altsetting;
 	hdev = interface_to_usbdev(intf);
@@ -711,23 +708,19 @@
 	}
 
 	/* Multiple endpoints? What kind of mutant ninja-hub is this? */
-	if (desc-&gt;desc.bNumEndpoints != 1) {
+	if (desc-&gt;desc.bNumEndpoints != 1)
 		goto descriptor_error;
-	}
 
 	endpoint = &amp;desc-&gt;endpoint[0].desc;
 
 	/* Output endpoint? Curiouser and curiouser.. */
-	if (!(endpoint-&gt;bEndpointAddress &amp; USB_DIR_IN)) {
+	if (!(endpoint-&gt;bEndpointAddress &amp; USB_DIR_IN))
 		goto descriptor_error;
-	}
 
 	/* If it's not an interrupt endpoint, we'd better punt! */
 	if ((endpoint-&gt;bmAttributes &amp; USB_ENDPOINT_XFERTYPE_MASK)
-			!= USB_ENDPOINT_XFER_INT) {
+			!= USB_ENDPOINT_XFER_INT)
 		goto descriptor_error;
-		return -EIO;
-	}
 
 	/* We found a hub */
 	dev_info (hub_dev, "USB hub found\n");
@@ -745,12 +738,6 @@
 	init_MUTEX(&amp;hub-&gt;khubd_sem);
 	INIT_WORK(&amp;hub-&gt;leds, led_work, hub);
 
-	/* Record the new hub's existence */
-	spin_lock_irqsave(&amp;hub_event_lock, flags);
-	INIT_LIST_HEAD(&amp;hub-&gt;hub_list);
-	list_add(&amp;hub-&gt;hub_list, &amp;hub_list);
-	spin_unlock_irqrestore(&amp;hub_event_lock, flags);
-
 	usb_set_intfdata (intf, hub);
 
 	if (hdev-&gt;speed == USB_SPEED_HIGH)
@@ -1581,9 +1568,6 @@
 	.id_table =	hub_id_table,
 };
 
-/*
- * This should be a separate module.
- */
 int usb_hub_init(void)
 {
 	pid_t pid;
diff -Nru a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
--- a/drivers/usb/core/hub.h	Fri Jun 18 11:05:28 2004
+++ b/drivers/usb/core/hub.h	Fri Jun 18 11:05:28 2004
@@ -202,7 +202,6 @@
 	int			error;		/* last reported error */
 	int			nerrors;	/* track consecutive errors */
 
-	struct list_head	hub_list;	/* all hubs */
 	struct list_head	event_list;	/* hubs w/data or errs ready */
 
 	struct usb_hub_descriptor *descriptor;	/* class descriptor */
</pre></body></html>