Skip to content

Commit

Permalink
USB: convert some miscellanies drivers to use module_usb_driver()
Browse files Browse the repository at this point in the history
This converts the remaining USB drivers in the kernel to use the
module_usb_driver() macro which makes the code smaller and a bit
simpler.

Added bonus is that it removes some unneeded kernel log messages about
drivers loading and/or unloading.

Cc: Guenter Roeck <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: Ben Dooks <[email protected]>
Cc: Till Harbaum <[email protected]>
Cc: Karsten Keil <[email protected]>
Cc: Chris Ball <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: Lauro Ramos Venancio <[email protected]>
Cc: Aloisio Almeida Jr <[email protected]>
Cc: Samuel Ortiz <[email protected]>
Cc: Steve Glendinning <[email protected]>
Cc: Florian Tobias Schandinat <[email protected]>
Cc: Evgeniy Polyakov <[email protected]>
Cc: Wim Van Sebroeck <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Jesper Juhl <[email protected]>
Cc: Artem Bityutskiy <[email protected]>
Cc: Jamie Iles <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gregkh committed Nov 18, 2011
1 parent 424f075 commit fe74848
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 216 deletions.
15 changes: 1 addition & 14 deletions drivers/i2c/busses/i2c-diolan-u2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,20 +515,7 @@ static struct usb_driver diolan_u2c_driver = {
.id_table = diolan_u2c_table,
};

static int __init diolan_u2c_init(void)
{
/* register this driver with the USB subsystem */
return usb_register(&diolan_u2c_driver);
}

static void __exit diolan_u2c_exit(void)
{
/* deregister this driver with the USB subsystem */
usb_deregister(&diolan_u2c_driver);
}

module_init(diolan_u2c_init);
module_exit(diolan_u2c_exit);
module_usb_driver(diolan_u2c_driver);

MODULE_AUTHOR("Guenter Roeck <[email protected]>");
MODULE_DESCRIPTION(DRIVER_NAME " driver");
Expand Down
15 changes: 1 addition & 14 deletions drivers/i2c/busses/i2c-tiny-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,20 +262,7 @@ static struct usb_driver i2c_tiny_usb_driver = {
.id_table = i2c_tiny_usb_table,
};

static int __init usb_i2c_tiny_usb_init(void)
{
/* register this driver with the USB subsystem */
return usb_register(&i2c_tiny_usb_driver);
}

static void __exit usb_i2c_tiny_usb_exit(void)
{
/* deregister this driver with the USB subsystem */
usb_deregister(&i2c_tiny_usb_driver);
}

module_init(usb_i2c_tiny_usb_init);
module_exit(usb_i2c_tiny_usb_exit);
module_usb_driver(i2c_tiny_usb_driver);

/* ----- end of usb layer ------------------------------------------------ */

Expand Down
28 changes: 1 addition & 27 deletions drivers/isdn/hardware/mISDN/hfcsusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2154,30 +2154,4 @@ static struct usb_driver hfcsusb_drv = {
.disconnect = hfcsusb_disconnect,
};

static int __init
hfcsusb_init(void)
{
printk(KERN_INFO DRIVER_NAME " driver Rev. %s debug(0x%x) poll(%i)\n",
hfcsusb_rev, debug, poll);

if (usb_register(&hfcsusb_drv)) {
printk(KERN_INFO DRIVER_NAME
": Unable to register hfcsusb module at usb stack\n");
return -ENODEV;
}

return 0;
}

static void __exit
hfcsusb_cleanup(void)
{
if (debug & DBG_HFC_CALL_TRACE)
printk(KERN_INFO DRIVER_NAME ": %s\n", __func__);

/* unregister Hardware */
usb_deregister(&hfcsusb_drv); /* release our driver */
}

module_init(hfcsusb_init);
module_exit(hfcsusb_cleanup);
module_usb_driver(hfcsusb_drv);
12 changes: 1 addition & 11 deletions drivers/mmc/host/ushc.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,17 +562,7 @@ static struct usb_driver ushc_driver = {
.disconnect = ushc_disconnect,
};

static int __init ushc_init(void)
{
return usb_register(&ushc_driver);
}
module_init(ushc_init);

static void __exit ushc_exit(void)
{
usb_deregister(&ushc_driver);
}
module_exit(ushc_exit);
module_usb_driver(ushc_driver);

MODULE_DESCRIPTION("USB SD Host Controller driver");
MODULE_AUTHOR("David Vrabel <[email protected]>");
Expand Down
13 changes: 1 addition & 12 deletions drivers/mtd/nand/alauda.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,17 +717,6 @@ static struct usb_driver alauda_driver = {
.id_table = alauda_table,
};

static int __init alauda_init(void)
{
return usb_register(&alauda_driver);
}

static void __exit alauda_exit(void)
{
usb_deregister(&alauda_driver);
}

module_init(alauda_init);
module_exit(alauda_exit);
module_usb_driver(alauda_driver);

MODULE_LICENSE("GPL");
19 changes: 1 addition & 18 deletions drivers/nfc/pn533.c
Original file line number Diff line number Diff line change
Expand Up @@ -1597,24 +1597,7 @@ static struct usb_driver pn533_driver = {
.id_table = pn533_table,
};

static int __init pn533_init(void)
{
int rc;

rc = usb_register(&pn533_driver);
if (rc)
err("usb_register failed. Error number %d", rc);

return rc;
}

static void __exit pn533_exit(void)
{
usb_deregister(&pn533_driver);
}

module_init(pn533_init);
module_exit(pn533_exit);
module_usb_driver(pn533_driver);

MODULE_AUTHOR("Lauro Ramos Venancio <[email protected]>,"
" Aloisio Almeida Jr <[email protected]>");
Expand Down
12 changes: 1 addition & 11 deletions drivers/uwb/hwa-rc.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,17 +914,7 @@ static struct usb_driver hwarc_driver = {
.post_reset = hwarc_post_reset,
};

static int __init hwarc_driver_init(void)
{
return usb_register(&hwarc_driver);
}
module_init(hwarc_driver_init);

static void __exit hwarc_driver_exit(void)
{
usb_deregister(&hwarc_driver);
}
module_exit(hwarc_driver_exit);
module_usb_driver(hwarc_driver);

MODULE_AUTHOR("Inaky Perez-Gonzalez <[email protected]>");
MODULE_DESCRIPTION("Host Wireless Adapter Radio Control Driver");
Expand Down
20 changes: 1 addition & 19 deletions drivers/uwb/i1480/dfu/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,25 +451,7 @@ static struct usb_driver i1480_dfu_driver = {
.disconnect = NULL,
};


/*
* Initialize the i1480 DFU driver.
*
* We also need to register our function for guessing event sizes.
*/
static int __init i1480_dfu_driver_init(void)
{
return usb_register(&i1480_dfu_driver);
}
module_init(i1480_dfu_driver_init);


static void __exit i1480_dfu_driver_exit(void)
{
usb_deregister(&i1480_dfu_driver);
}
module_exit(i1480_dfu_driver_exit);

module_usb_driver(i1480_dfu_driver);

MODULE_AUTHOR("Inaky Perez-Gonzalez <[email protected]>");
MODULE_DESCRIPTION("Intel Wireless UWB Link 1480 firmware uploader for USB");
Expand Down
19 changes: 1 addition & 18 deletions drivers/video/smscufx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1792,24 +1792,7 @@ static struct usb_driver ufx_driver = {
.id_table = id_table,
};

static int __init ufx_module_init(void)
{
int res;

res = usb_register(&ufx_driver);
if (res)
err("usb_register failed. Error number %d", res);

return res;
}

static void __exit ufx_module_exit(void)
{
usb_deregister(&ufx_driver);
}

module_init(ufx_module_init);
module_exit(ufx_module_exit);
module_usb_driver(ufx_driver);

static void ufx_urb_completion(struct urb *urb)
{
Expand Down
19 changes: 1 addition & 18 deletions drivers/video/udlfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1761,24 +1761,7 @@ static struct usb_driver dlfb_driver = {
.id_table = id_table,
};

static int __init dlfb_module_init(void)
{
int res;

res = usb_register(&dlfb_driver);
if (res)
err("usb_register failed. Error number %d", res);

return res;
}

static void __exit dlfb_module_exit(void)
{
usb_deregister(&dlfb_driver);
}

module_init(dlfb_module_init);
module_exit(dlfb_module_exit);
module_usb_driver(dlfb_driver);

static void dlfb_urb_completion(struct urb *urb)
{
Expand Down
21 changes: 1 addition & 20 deletions drivers/w1/masters/ds2490.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,26 +1002,7 @@ static void ds_disconnect(struct usb_interface *intf)
kfree(dev);
}

static int ds_init(void)
{
int err;

err = usb_register(&ds_driver);
if (err) {
printk(KERN_INFO "Failed to register DS9490R USB device: err=%d.\n", err);
return err;
}

return 0;
}

static void ds_fini(void)
{
usb_deregister(&ds_driver);
}

module_init(ds_init);
module_exit(ds_fini);
module_usb_driver(ds_driver);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Evgeniy Polyakov <[email protected]>");
Expand Down
35 changes: 1 addition & 34 deletions drivers/watchdog/pcwd_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,37 +827,4 @@ static void usb_pcwd_disconnect(struct usb_interface *interface)
printk(KERN_INFO PFX "USB PC Watchdog disconnected\n");
}



/**
* usb_pcwd_init
*/
static int __init usb_pcwd_init(void)
{
int result;

/* register this driver with the USB subsystem */
result = usb_register(&usb_pcwd_driver);
if (result) {
printk(KERN_ERR PFX "usb_register failed. Error number %d\n",
result);
return result;
}

printk(KERN_INFO PFX DRIVER_DESC " v" DRIVER_VERSION "\n");
return 0;
}


/**
* usb_pcwd_exit
*/
static void __exit usb_pcwd_exit(void)
{
/* deregister this driver with the USB subsystem */
usb_deregister(&usb_pcwd_driver);
}


module_init(usb_pcwd_init);
module_exit(usb_pcwd_exit);
module_usb_driver(usb_pcwd_driver);

0 comments on commit fe74848

Please sign in to comment.