patch-2.4.0-test11 linux/drivers/usb/hub.c
Next file: linux/drivers/usb/ibmcam.c
Previous file: linux/drivers/usb/hid.c
Back to the patch index
Back to the overall index
- Lines: 97
- Date:
Fri Nov 17 16:44:55 2000
- Orig file:
v2.4.0-test10/linux/drivers/usb/hub.c
- Orig date:
Tue Oct 31 12:42:27 2000
diff -u --recursive --new-file v2.4.0-test10/linux/drivers/usb/hub.c linux/drivers/usb/hub.c
@@ -36,7 +36,7 @@
static DECLARE_WAIT_QUEUE_HEAD(khubd_wait);
static int khubd_pid = 0; /* PID of khubd */
-static int khubd_running = 0;
+static DECLARE_MUTEX_LOCKED(khubd_exited);
static int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size)
{
@@ -235,7 +235,9 @@
return 0;
}
-static void *hub_probe(struct usb_device *dev, unsigned int i)
+static void *hub_probe(struct usb_device *dev, unsigned int i,
+ const struct usb_device_id *id)
+
{
struct usb_interface_descriptor *interface;
struct usb_endpoint_descriptor *endpoint;
@@ -244,10 +246,6 @@
interface = &dev->actconfig->interface[i].altsetting[0];
- /* Is it a hub? */
- if (interface->bInterfaceClass != USB_CLASS_HUB)
- return NULL;
-
/* Some hubs have a subclass of 1, which AFAICT according to the */
/* specs is not defined, but it works */
if ((interface->bInterfaceSubClass != 0) &&
@@ -743,17 +741,13 @@
static int usb_hub_thread(void *__hub)
{
- khubd_running = 1;
-
lock_kernel();
/*
* This thread doesn't need any user-level access,
* so get rid of all our resources
*/
- exit_files(current); /* daemonize doesn't do exit_files */
- current->files = init_task.files;
- atomic_inc(¤t->files->count);
+
daemonize();
/* Setup a nice name */
@@ -766,16 +760,23 @@
} while (!signal_pending(current));
dbg("usb_hub_thread exiting");
- khubd_running = 0;
- return 0;
+ up_and_exit(&khubd_exited, 0);
}
+static struct usb_device_id hub_id_table [] = {
+ { bInterfaceClass: USB_CLASS_HUB},
+ { } /* Terminating entry */
+};
+
+MODULE_DEVICE_TABLE (usb, hub_id_table);
+
static struct usb_driver hub_driver = {
name: "hub",
probe: hub_probe,
ioctl: hub_ioctl,
- disconnect: hub_disconnect
+ disconnect: hub_disconnect,
+ id_table: hub_id_table,
};
/*
@@ -811,18 +812,8 @@
/* Kill the thread */
ret = kill_proc(khubd_pid, SIGTERM, 1);
- if (!ret) {
- /* Wait 10 seconds */
- int count = 10 * 100;
- while (khubd_running && --count) {
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(1);
- }
-
- if (!count)
- err("giving up on killing khubd");
- }
+ down(&khubd_exited);
/*
* Hub resources are freed for us by usb_deregister. It calls
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)