From fe7484834bb614c2c205726647635171ce6cc070 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 18 Nov 2011 09:52:10 -0800 Subject: [PATCH] USB: convert some miscellanies drivers to use module_usb_driver() 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 Cc: Jean Delvare Cc: Ben Dooks Cc: Till Harbaum Cc: Karsten Keil Cc: Chris Ball Cc: David Woodhouse Cc: Lauro Ramos Venancio Cc: Aloisio Almeida Jr Cc: Samuel Ortiz Cc: Steve Glendinning Cc: Florian Tobias Schandinat Cc: Evgeniy Polyakov Cc: Wim Van Sebroeck Cc: "David S. Miller" Cc: Jesper Juhl Cc: Artem Bityutskiy Cc: Jamie Iles Cc: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-diolan-u2c.c | 15 +-------------- drivers/i2c/busses/i2c-tiny-usb.c | 15 +-------------- drivers/isdn/hardware/mISDN/hfcsusb.c | 28 +--------------------------- drivers/mmc/host/ushc.c | 12 +----------- drivers/mtd/nand/alauda.c | 13 +------------ drivers/nfc/pn533.c | 19 +------------------ drivers/uwb/hwa-rc.c | 12 +----------- drivers/uwb/i1480/dfu/usb.c | 20 +------------------- drivers/video/smscufx.c | 19 +------------------ drivers/video/udlfb.c | 19 +------------------ drivers/w1/masters/ds2490.c | 21 +-------------------- drivers/watchdog/pcwd_usb.c | 35 +---------------------------------- 12 files changed, 12 insertions(+), 216 deletions(-) diff --git a/drivers/i2c/busses/i2c-diolan-u2c.c b/drivers/i2c/busses/i2c-diolan-u2c.c index 76366716a85..7eb19a5222f 100644 --- a/drivers/i2c/busses/i2c-diolan-u2c.c +++ b/drivers/i2c/busses/i2c-diolan-u2c.c @@ -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 "); MODULE_DESCRIPTION(DRIVER_NAME " driver"); diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c index d03b04002f0..f07307ff360 100644 --- a/drivers/i2c/busses/i2c-tiny-usb.c +++ b/drivers/i2c/busses/i2c-tiny-usb.c @@ -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 ------------------------------------------------ */ diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 71a8eb6ef71..0e1f4d5b977 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c @@ -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); diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c index f08f944ac53..c0105a2e269 100644 --- a/drivers/mmc/host/ushc.c +++ b/drivers/mmc/host/ushc.c @@ -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 "); diff --git a/drivers/mtd/nand/alauda.c b/drivers/mtd/nand/alauda.c index eb40ea829ab..6a5ff64a139 100644 --- a/drivers/mtd/nand/alauda.c +++ b/drivers/mtd/nand/alauda.c @@ -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"); diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index 7bcb1febef0..bd023847efb 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c @@ -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 ," " Aloisio Almeida Jr "); diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c index 2babcd4fbfc..66797e9c501 100644 --- a/drivers/uwb/hwa-rc.c +++ b/drivers/uwb/hwa-rc.c @@ -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 "); MODULE_DESCRIPTION("Host Wireless Adapter Radio Control Driver"); diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c index ba8664328af..c8f684833d5 100644 --- a/drivers/uwb/i1480/dfu/usb.c +++ b/drivers/uwb/i1480/dfu/usb.c @@ -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 "); MODULE_DESCRIPTION("Intel Wireless UWB Link 1480 firmware uploader for USB"); diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c index aaccffac67a..3c22994ea31 100644 --- a/drivers/video/smscufx.c +++ b/drivers/video/smscufx.c @@ -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) { diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c index 3473e75ce78..1f868d0187a 100644 --- a/drivers/video/udlfb.c +++ b/drivers/video/udlfb.c @@ -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) { diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c index b5abaae38e9..4f7e1d770f8 100644 --- a/drivers/w1/masters/ds2490.c +++ b/drivers/w1/masters/ds2490.c @@ -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 "); diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 748a74bd85e..d8de1ddd176 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c @@ -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); -- 2.11.4.GIT