diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2011-11-18 21:34:02 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-11-18 21:34:02 +0400 |
commit | 65db43054065790a75291b0834657445fea2cf56 (patch) | |
tree | 000b010ed36dc99c4695178a6cb8a797a3d24865 /drivers/usb/misc | |
parent | f3a6a4b6cfc80e57bf16bb12f9425bec1a5731a9 (diff) | |
download | linux-65db43054065790a75291b0834657445fea2cf56.tar.xz |
USB: convert drivers/usb/* to use module_usb_driver()
This converts the drivers in drivers/usb/* 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: Simon Arlott <cxacru@fire.lp0.eu>
Cc: Duncan Sands <duncan.sands@free.fr>
Cc: Matthieu CASTET <castet.matthieu@free.fr>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: Juergen Stuber <starblue@users.sourceforge.net>
Cc: Cesar Miquel <miquel@df.uba.ar>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: Michael Hund <mhund@ld-didactic.de>
Cc: Zack Parsons <k3bacon@gmail.com>
Cc: Melchior FRANZ <mfranz@aon.at>
Cc: Tomoki Sekiyama <tomoki.sekiyama@gmail.com>
Cc: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r-- | drivers/usb/misc/adutux.c | 35 | ||||
-rw-r--r-- | drivers/usb/misc/cypress_cy7c63.c | 22 | ||||
-rw-r--r-- | drivers/usb/misc/cytherm.c | 26 | ||||
-rw-r--r-- | drivers/usb/misc/emi26.c | 13 | ||||
-rw-r--r-- | drivers/usb/misc/emi62.c | 17 | ||||
-rw-r--r-- | drivers/usb/misc/idmouse.c | 24 | ||||
-rw-r--r-- | drivers/usb/misc/iowarrior.c | 13 | ||||
-rw-r--r-- | drivers/usb/misc/isight_firmware.c | 13 | ||||
-rw-r--r-- | drivers/usb/misc/ldusb.c | 27 | ||||
-rw-r--r-- | drivers/usb/misc/legousbtower.c | 46 | ||||
-rw-r--r-- | drivers/usb/misc/rio500.c | 28 | ||||
-rw-r--r-- | drivers/usb/misc/trancevibrator.c | 21 | ||||
-rw-r--r-- | drivers/usb/misc/usblcd.c | 20 | ||||
-rw-r--r-- | drivers/usb/misc/usbled.c | 18 | ||||
-rw-r--r-- | drivers/usb/misc/usbsevseg.c | 18 | ||||
-rw-r--r-- | drivers/usb/misc/yurex.c | 22 |
16 files changed, 16 insertions, 347 deletions
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index fe858711651c..284b85461410 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -885,40 +885,7 @@ static struct usb_driver adu_driver = { .id_table = device_table, }; -static int __init adu_init(void) -{ - int result; - - dbg(2," %s : enter", __func__); - - /* register this driver with the USB subsystem */ - result = usb_register(&adu_driver); - if (result < 0) { - printk(KERN_ERR "usb_register failed for the "__FILE__ - " driver. Error number %d\n", result); - goto exit; - } - - printk(KERN_INFO "adutux " DRIVER_DESC " " DRIVER_VERSION "\n"); - printk(KERN_INFO "adutux is an experimental driver. " - "Use at your own risk\n"); - -exit: - dbg(2," %s : leave, return value %d", __func__, result); - - return result; -} - -static void __exit adu_exit(void) -{ - dbg(2," %s : enter", __func__); - /* deregister this driver with the USB subsystem */ - usb_deregister(&adu_driver); - dbg(2," %s : leave", __func__); -} - -module_init(adu_init); -module_exit(adu_exit); +module_usb_driver(adu_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c index 9251773ecef4..3f7c1a92579f 100644 --- a/drivers/usb/misc/cypress_cy7c63.c +++ b/drivers/usb/misc/cypress_cy7c63.c @@ -271,27 +271,7 @@ static struct usb_driver cypress_driver = { .id_table = cypress_table, }; -static int __init cypress_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&cypress_driver); - if (result) - printk(KERN_ERR KBUILD_MODNAME ": usb_register failed! " - "Error number: %d\n", result); - - return result; -} - -static void __exit cypress_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&cypress_driver); -} - -module_init(cypress_init); -module_exit(cypress_exit); +module_usb_driver(cypress_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c index 1d7251bc1b5f..5b9831b95d97 100644 --- a/drivers/usb/misc/cytherm.c +++ b/drivers/usb/misc/cytherm.c @@ -417,31 +417,7 @@ static void cytherm_disconnect(struct usb_interface *interface) dev_info(&interface->dev, "Cypress thermometer now disconnected\n"); } - -static int __init usb_cytherm_init(void) -{ - int result; - - result = usb_register(&cytherm_driver); - if (result) { - printk(KERN_ERR KBUILD_MODNAME ": usb_register failed! " - "Error number: %d\n", result); - return result; - } - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return 0; -} - -static void __exit usb_cytherm_exit(void) -{ - usb_deregister(&cytherm_driver); -} - - -module_init (usb_cytherm_init); -module_exit (usb_cytherm_exit); +module_usb_driver(cytherm_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index a6521c95f683..d9b6a0355443 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c @@ -276,18 +276,7 @@ static struct usb_driver emi26_driver = { .id_table = id_table, }; -static int __init emi26_init (void) -{ - return usb_register(&emi26_driver); -} - -static void __exit emi26_exit (void) -{ - usb_deregister (&emi26_driver); -} - -module_init(emi26_init); -module_exit(emi26_exit); +module_usb_driver(emi26_driver); MODULE_AUTHOR("Tapio Laxström"); MODULE_DESCRIPTION("Emagic EMI 2|6 firmware loader."); diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c index fc15ad4c3139..9f39062ebb08 100644 --- a/drivers/usb/misc/emi62.c +++ b/drivers/usb/misc/emi62.c @@ -290,22 +290,7 @@ static struct usb_driver emi62_driver = { .id_table = id_table, }; -static int __init emi62_init (void) -{ - int retval; - retval = usb_register (&emi62_driver); - if (retval) - printk(KERN_ERR "adi-emi: registration failed\n"); - return retval; -} - -static void __exit emi62_exit (void) -{ - usb_deregister (&emi62_driver); -} - -module_init(emi62_init); -module_exit(emi62_exit); +module_usb_driver(emi62_driver); MODULE_AUTHOR("Tapio Laxström"); MODULE_DESCRIPTION("Emagic EMI 6|2m firmware loader."); diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index 515b67fffab1..0dee24698504 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -428,29 +428,7 @@ static void idmouse_disconnect(struct usb_interface *interface) dev_info(&interface->dev, "disconnected\n"); } -static int __init usb_idmouse_init(void) -{ - int result; - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - - /* register this driver with the USB subsystem */ - result = usb_register(&idmouse_driver); - if (result) - err("Unable to register device (error %d).", result); - - return result; -} - -static void __exit usb_idmouse_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&idmouse_driver); -} - -module_init(usb_idmouse_init); -module_exit(usb_idmouse_exit); +module_usb_driver(idmouse_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 81457904d6ba..7676b5b7e171 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -927,15 +927,4 @@ static struct usb_driver iowarrior_driver = { .id_table = iowarrior_ids, }; -static int __init iowarrior_init(void) -{ - return usb_register(&iowarrior_driver); -} - -static void __exit iowarrior_exit(void) -{ - usb_deregister(&iowarrior_driver); -} - -module_init(iowarrior_init); -module_exit(iowarrior_exit); +module_usb_driver(iowarrior_driver); diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c index fe1d44319d0a..1dc7e9581cc6 100644 --- a/drivers/usb/misc/isight_firmware.c +++ b/drivers/usb/misc/isight_firmware.c @@ -126,18 +126,7 @@ static struct usb_driver isight_firmware_driver = { .id_table = id_table, }; -static int __init isight_firmware_init(void) -{ - return usb_register(&isight_firmware_driver); -} - -static void __exit isight_firmware_exit(void) -{ - usb_deregister(&isight_firmware_driver); -} - -module_init(isight_firmware_init); -module_exit(isight_firmware_exit); +module_usb_driver(isight_firmware_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 48c166f0d764..5db4ab52061e 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -821,30 +821,5 @@ static struct usb_driver ld_usb_driver = { .id_table = ld_usb_table, }; -/** - * ld_usb_init - */ -static int __init ld_usb_init(void) -{ - int retval; - - /* register this driver with the USB subsystem */ - retval = usb_register(&ld_usb_driver); - if (retval) - err("usb_register failed for the %s driver. Error number %d\n", __FILE__, retval); - - return retval; -} - -/** - * ld_usb_exit - */ -static void __exit ld_usb_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&ld_usb_driver); -} - -module_init(ld_usb_init); -module_exit(ld_usb_exit); +module_usb_driver(ld_usb_driver); diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index a989356f693e..16937da31cd8 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -1043,51 +1043,7 @@ static void tower_disconnect (struct usb_interface *interface) dbg(2, "%s: leave", __func__); } - - -/** - * lego_usb_tower_init - */ -static int __init lego_usb_tower_init(void) -{ - int result; - int retval = 0; - - dbg(2, "%s: enter", __func__); - - /* register this driver with the USB subsystem */ - result = usb_register(&tower_driver); - if (result < 0) { - err("usb_register failed for the %s driver. Error number %d", __FILE__, result); - retval = -1; - goto exit; - } - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - -exit: - dbg(2, "%s: leave, return value %d", __func__, retval); - - return retval; -} - - -/** - * lego_usb_tower_exit - */ -static void __exit lego_usb_tower_exit(void) -{ - dbg(2, "%s: enter", __func__); - - /* deregister this driver with the USB subsystem */ - usb_deregister (&tower_driver); - - dbg(2, "%s: leave", __func__); -} - -module_init (lego_usb_tower_init); -module_exit (lego_usb_tower_exit); +module_usb_driver(tower_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index 4e23d3841b43..487a8ce0775e 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c @@ -531,33 +531,7 @@ static struct usb_driver rio_driver = { .id_table = rio_table, }; -static int __init usb_rio_init(void) -{ - int retval; - retval = usb_register(&rio_driver); - if (retval) - goto out; - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - -out: - return retval; -} - - -static void __exit usb_rio_cleanup(void) -{ - struct rio_usb_data *rio = &rio_instance; - - rio->present = 0; - usb_deregister(&rio_driver); - - -} - -module_init(usb_rio_init); -module_exit(usb_rio_cleanup); +module_usb_driver(rio_driver); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c index f63776a48e2a..741efed4a236 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c @@ -137,26 +137,7 @@ static struct usb_driver tv_driver = { .id_table = id_table, }; -static int __init tv_init(void) -{ - int retval = usb_register(&tv_driver); - if (retval) { - err("usb_register failed. Error number %d", retval); - return retval; - } - - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return 0; -} - -static void __exit tv_exit(void) -{ - usb_deregister(&tv_driver); -} - -module_init (tv_init); -module_exit (tv_exit); +module_usb_driver(tv_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 1871cdf10da3..e2b4bd31c2b6 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c @@ -450,25 +450,7 @@ static struct usb_driver lcd_driver = { .supports_autosuspend = 1, }; -static int __init usb_lcd_init(void) -{ - int result; - - result = usb_register(&lcd_driver); - if (result) - err("usb_register failed. Error number %d", result); - - return result; -} - - -static void __exit usb_lcd_exit(void) -{ - usb_deregister(&lcd_driver); -} - -module_init(usb_lcd_init); -module_exit(usb_lcd_exit); +module_usb_driver(lcd_driver); MODULE_AUTHOR("Georges Toth <g.toth@e-biz.lu>"); MODULE_DESCRIPTION(DRIVER_VERSION); diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 43f84e50d514..4af56fbc3c06 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c @@ -231,23 +231,7 @@ static struct usb_driver led_driver = { .id_table = id_table, }; -static int __init usb_led_init(void) -{ - int retval = 0; - - retval = usb_register(&led_driver); - if (retval) - err("usb_register failed. Error number %d", retval); - return retval; -} - -static void __exit usb_led_exit(void) -{ - usb_deregister(&led_driver); -} - -module_init(usb_led_init); -module_exit(usb_led_exit); +module_usb_driver(led_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c index 417b8f207e8b..107bf13b1cf1 100644 --- a/drivers/usb/misc/usbsevseg.c +++ b/drivers/usb/misc/usbsevseg.c @@ -437,23 +437,7 @@ static struct usb_driver sevseg_driver = { .supports_autosuspend = 1, }; -static int __init usb_sevseg_init(void) -{ - int rc = 0; - - rc = usb_register(&sevseg_driver); - if (rc) - err("usb_register failed. Error number %d", rc); - return rc; -} - -static void __exit usb_sevseg_exit(void) -{ - usb_deregister(&sevseg_driver); -} - -module_init(usb_sevseg_init); -module_exit(usb_sevseg_exit); +module_usb_driver(sevseg_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index ac5bfd619e62..897edda42270 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c @@ -539,26 +539,6 @@ static const struct file_operations yurex_fops = { .llseek = default_llseek, }; - -static int __init usb_yurex_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&yurex_driver); - if (result) - err("usb_register failed. Error number %d", result); - - return result; -} - -static void __exit usb_yurex_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&yurex_driver); -} - -module_init(usb_yurex_init); -module_exit(usb_yurex_exit); +module_usb_driver(yurex_driver); MODULE_LICENSE("GPL"); |