Commit 714279be authored by Patrick Mochel's avatar Patrick Mochel

USB: fixup handling of generic USB driver.

The generic driver is used by the virtual USB bridge device. This makes sure that
the driver is registered before we try to use it (and it gets the bus type right).

We also check for equality when matching devices to drivers, because we don't 
want to match any device to it. 
parent 4ee5a59e
...@@ -63,7 +63,8 @@ static void generic_release (struct device_driver * drv) ...@@ -63,7 +63,8 @@ static void generic_release (struct device_driver * drv)
} }
static struct device_driver usb_generic_driver = { static struct device_driver usb_generic_driver = {
.name = "generic usb driver", .name = "generic",
.bus = &usb_bus_type,
.probe = generic_probe, .probe = generic_probe,
.remove = generic_remove, .remove = generic_remove,
.release = generic_release, .release = generic_release,
...@@ -470,6 +471,10 @@ static int usb_device_match (struct device *dev, struct device_driver *drv) ...@@ -470,6 +471,10 @@ static int usb_device_match (struct device *dev, struct device_driver *drv)
struct usb_driver *usb_drv; struct usb_driver *usb_drv;
const struct usb_device_id *id; const struct usb_device_id *id;
/* check for generic driver, which we don't match any device with */
if (drv == &usb_generic_driver)
return 0;
intf = to_usb_interface(dev); intf = to_usb_interface(dev);
usb_drv = to_usb_driver(drv); usb_drv = to_usb_driver(drv);
...@@ -1445,6 +1450,8 @@ static int __init usb_init(void) ...@@ -1445,6 +1450,8 @@ static int __init usb_init(void)
usbfs_init(); usbfs_init();
usb_hub_init(); usb_hub_init();
driver_register(&usb_generic_driver);
return 0; return 0;
} }
...@@ -1453,6 +1460,7 @@ static int __init usb_init(void) ...@@ -1453,6 +1460,7 @@ static int __init usb_init(void)
*/ */
static void __exit usb_exit(void) static void __exit usb_exit(void)
{ {
remove_driver(&usb_generic_driver);
usb_major_cleanup(); usb_major_cleanup();
usbfs_cleanup(); usbfs_cleanup();
usb_hub_cleanup(); usb_hub_cleanup();
......
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