Commit 519241b2 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[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: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 1b582aaa
......@@ -9,6 +9,11 @@
*/
#include <linux/config.h>
#ifdef CONFIG_USB_DEBUG
#define DEBUG
#else
#undef DEBUG
#endif
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
......@@ -19,11 +24,6 @@
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/ioctl.h>
#ifdef CONFIG_USB_DEBUG
#define DEBUG
#else
#undef DEBUG
#endif
#include <linux/usb.h>
#include <linux/usbdevice_fs.h>
#include <linux/suspend.h>
......@@ -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 @@ static void hub_irq(struct urb *urb, struct pt_regs *regs)
if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0
/* ENODEV means we raced disconnect() */
&& status != -ENODEV)
dev_err (&hub->intf->dev, "resubmit --> %d\n", urb->status);
dev_err (&hub->intf->dev, "resubmit --> %d\n", status);
if (status == 0)
hub->urb_active = 1;
done:
......@@ -646,7 +645,6 @@ static void hub_disconnect(struct usb_interface *intf)
/* Delete it and then reset it */
list_del_init(&hub->event_list);
list_del_init(&hub->hub_list);
spin_unlock_irqrestore(&hub_event_lock, flags);
......@@ -695,7 +693,6 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
struct usb_device *hdev;
struct usb_hub *hub;
struct device *hub_dev;
unsigned long flags;
desc = intf->cur_altsetting;
hdev = interface_to_usbdev(intf);
......@@ -711,23 +708,19 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
}
/* Multiple endpoints? What kind of mutant ninja-hub is this? */
if (desc->desc.bNumEndpoints != 1) {
if (desc->desc.bNumEndpoints != 1)
goto descriptor_error;
}
endpoint = &desc->endpoint[0].desc;
/* Output endpoint? Curiouser and curiouser.. */
if (!(endpoint->bEndpointAddress & USB_DIR_IN)) {
if (!(endpoint->bEndpointAddress & USB_DIR_IN))
goto descriptor_error;
}
/* If it's not an interrupt endpoint, we'd better punt! */
if ((endpoint->bmAttributes & 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 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
init_MUTEX(&hub->khubd_sem);
INIT_WORK(&hub->leds, led_work, hub);
/* Record the new hub's existence */
spin_lock_irqsave(&hub_event_lock, flags);
INIT_LIST_HEAD(&hub->hub_list);
list_add(&hub->hub_list, &hub_list);
spin_unlock_irqrestore(&hub_event_lock, flags);
usb_set_intfdata (intf, hub);
if (hdev->speed == USB_SPEED_HIGH)
......@@ -1581,9 +1568,6 @@ static struct usb_driver hub_driver = {
.id_table = hub_id_table,
};
/*
* This should be a separate module.
*/
int usb_hub_init(void)
{
pid_t pid;
......
......@@ -202,7 +202,6 @@ struct usb_hub {
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 */
......
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