From 65db43054065790a75291b0834657445fea2cf56 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 18 Nov 2011 09:34:02 -0800 Subject: 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 Cc: Duncan Sands Cc: Matthieu CASTET Cc: Stanislaw Gruszka Cc: Pete Zaitcev Cc: Oliver Neukum Cc: Juergen Stuber Cc: Cesar Miquel Cc: Matthew Dharm Cc: Matthew Wilcox Cc: Sarah Sharp Cc: Kuninori Morimoto Cc: Felipe Balbi Cc: Lucas De Marchi Cc: Michael Hund Cc: Zack Parsons Cc: Melchior FRANZ Cc: Tomoki Sekiyama Cc: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/usb/atm/cxacru.c | 13 +---------- drivers/usb/atm/speedtch.c | 17 +------------- drivers/usb/atm/ueagle-atm.c | 31 +------------------------ drivers/usb/class/cdc-wdm.c | 19 +-------------- drivers/usb/class/usblp.c | 13 +---------- drivers/usb/class/usbtmc.c | 17 +------------- drivers/usb/host/hwa-hc.c | 13 +---------- drivers/usb/image/microtek.c | 14 +---------- drivers/usb/misc/adutux.c | 35 +--------------------------- drivers/usb/misc/cypress_cy7c63.c | 22 +----------------- drivers/usb/misc/cytherm.c | 26 +-------------------- drivers/usb/misc/emi26.c | 13 +---------- drivers/usb/misc/emi62.c | 17 +------------- drivers/usb/misc/idmouse.c | 24 +------------------ drivers/usb/misc/iowarrior.c | 13 +---------- drivers/usb/misc/isight_firmware.c | 13 +---------- drivers/usb/misc/ldusb.c | 27 +--------------------- drivers/usb/misc/legousbtower.c | 46 +------------------------------------ drivers/usb/misc/rio500.c | 28 +--------------------- drivers/usb/misc/trancevibrator.c | 21 +---------------- drivers/usb/misc/usblcd.c | 20 +--------------- drivers/usb/misc/usbled.c | 18 +-------------- drivers/usb/misc/usbsevseg.c | 18 +-------------- drivers/usb/misc/yurex.c | 22 +----------------- drivers/usb/storage/alauda.c | 13 +---------- drivers/usb/storage/cypress_atacb.c | 13 +---------- drivers/usb/storage/datafab.c | 13 +---------- drivers/usb/storage/ene_ub6250.c | 13 +---------- drivers/usb/storage/freecom.c | 13 +---------- drivers/usb/storage/isd200.c | 13 +---------- drivers/usb/storage/jumpshot.c | 13 +---------- drivers/usb/storage/karma.c | 13 +---------- drivers/usb/storage/onetouch.c | 13 +---------- drivers/usb/storage/realtek_cr.c | 13 +---------- drivers/usb/storage/sddr09.c | 13 +---------- drivers/usb/storage/sddr55.c | 13 +---------- drivers/usb/storage/shuttle_usbat.c | 13 +---------- drivers/usb/storage/uas.c | 13 +---------- drivers/usb/usb-skeleton.c | 21 +---------------- drivers/usb/wusbcore/cbaf.c | 12 +--------- 40 files changed, 40 insertions(+), 675 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index a845f8b8382..98b89fe1986 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c @@ -1372,18 +1372,7 @@ static struct usb_driver cxacru_usb_driver = { .id_table = cxacru_usb_ids }; -static int __init cxacru_init(void) -{ - return usb_register(&cxacru_usb_driver); -} - -static void __exit cxacru_cleanup(void) -{ - usb_deregister(&cxacru_usb_driver); -} - -module_init(cxacru_init); -module_exit(cxacru_cleanup); +module_usb_driver(cxacru_usb_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 0842cfbf60c..b42092e1f16 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c @@ -953,22 +953,7 @@ static int speedtch_usb_probe(struct usb_interface *intf, const struct usb_devic return usbatm_usb_probe(intf, id, &speedtch_usbatm_driver); } -static int __init speedtch_usb_init(void) -{ - dbg("%s: driver version %s", __func__, DRIVER_VERSION); - - return usb_register(&speedtch_usb_driver); -} - -static void __exit speedtch_usb_cleanup(void) -{ - dbg("%s", __func__); - - usb_deregister(&speedtch_usb_driver); -} - -module_init(speedtch_usb_init); -module_exit(speedtch_usb_cleanup); +module_usb_driver(speedtch_usb_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index 428f36801e0..00f171a7a8a 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c @@ -2753,36 +2753,7 @@ static struct usb_driver uea_driver = { MODULE_DEVICE_TABLE(usb, uea_ids); -/** - * uea_init - Initialize the module. - * Register to USB subsystem - */ -static int __init uea_init(void) -{ - printk(KERN_INFO "[ueagle-atm] driver " EAGLEUSBVERSION " loaded\n"); - - usb_register(&uea_driver); - - return 0; -} - -module_init(uea_init); - -/** - * uea_exit - Destroy module - * Deregister with USB subsystem - */ -static void __exit uea_exit(void) -{ - /* - * This calls automatically the uea_disconnect method if necessary: - */ - usb_deregister(&uea_driver); - - printk(KERN_INFO "[ueagle-atm] driver unloaded\n"); -} - -module_exit(uea_exit); +module_usb_driver(uea_driver); MODULE_AUTHOR("Damien Bergamini/Matthieu Castet/Stanislaw W. Gruszka"); MODULE_DESCRIPTION("ADI 930/Eagle USB ADSL Modem driver"); diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index efe684908c1..1c50baff772 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -895,24 +895,7 @@ static struct usb_driver wdm_driver = { .supports_autosuspend = 1, }; -/* --- low level module stuff --- */ - -static int __init wdm_init(void) -{ - int rv; - - rv = usb_register(&wdm_driver); - - return rv; -} - -static void __exit wdm_exit(void) -{ - usb_deregister(&wdm_driver); -} - -module_init(wdm_init); -module_exit(wdm_exit); +module_usb_driver(wdm_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index cb3a93243a0..81ef2e207a8 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -1412,18 +1412,7 @@ static struct usb_driver usblp_driver = { .supports_autosuspend = 1, }; -static int __init usblp_init(void) -{ - return usb_register(&usblp_driver); -} - -static void __exit usblp_exit(void) -{ - usb_deregister(&usblp_driver); -} - -module_init(usblp_init); -module_exit(usblp_exit); +module_usb_driver(usblp_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 12cf5e7395a..70d69d06054 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c @@ -1116,21 +1116,6 @@ static struct usb_driver usbtmc_driver = { .resume = usbtmc_resume, }; -static int __init usbtmc_init(void) -{ - int retcode; - - retcode = usb_register(&usbtmc_driver); - if (retcode) - printk(KERN_ERR KBUILD_MODNAME": Unable to register driver\n"); - return retcode; -} -module_init(usbtmc_init); - -static void __exit usbtmc_exit(void) -{ - usb_deregister(&usbtmc_driver); -} -module_exit(usbtmc_exit); +module_usb_driver(usbtmc_driver); MODULE_LICENSE("GPL"); diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c index 9bfac657572..056fb2d37c8 100644 --- a/drivers/usb/host/hwa-hc.c +++ b/drivers/usb/host/hwa-hc.c @@ -837,18 +837,7 @@ static struct usb_driver hwahc_driver = { .id_table = hwahc_id_table, }; -static int __init hwahc_driver_init(void) -{ - return usb_register(&hwahc_driver); -} -module_init(hwahc_driver_init); - -static void __exit hwahc_driver_exit(void) -{ - usb_deregister(&hwahc_driver); -} -module_exit(hwahc_driver_exit); - +module_usb_driver(hwahc_driver); MODULE_AUTHOR("Inaky Perez-Gonzalez "); MODULE_DESCRIPTION("Host Wired Adapter USB Host Control Driver"); diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 27e209a7222..9c0f8caba3b 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c @@ -809,19 +809,7 @@ static void mts_usb_disconnect (struct usb_interface *intf) kfree(desc); } - -static int __init microtek_drv_init(void) -{ - return usb_register(&mts_usb_driver); -} - -static void __exit microtek_drv_exit(void) -{ - usb_deregister(&mts_usb_driver); -} - -module_init(microtek_drv_init); -module_exit(microtek_drv_exit); +module_usb_driver(mts_usb_driver); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index fe858711651..284b8546141 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 9251773ecef..3f7c1a92579 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 1d7251bc1b5..5b9831b95d9 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 a6521c95f68..d9b6a035544 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 fc15ad4c313..9f39062ebb0 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 515b67fffab..0dee2469850 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 81457904d6b..7676b5b7e17 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 fe1d44319d0..1dc7e9581cc 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 "); diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 48c166f0d76..5db4ab52061 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 a989356f693..16937da31cd 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 4e23d3841b4..487a8ce0775 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 f63776a48e2..741efed4a23 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 1871cdf10da..e2b4bd31c2b 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 "); MODULE_DESCRIPTION(DRIVER_VERSION); diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 43f84e50d51..4af56fbc3c0 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 417b8f207e8..107bf13b1cf 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 ac5bfd619e6..897edda4227 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"); diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 42d0eaed4a0..3ca87a82334 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c @@ -1278,15 +1278,4 @@ static struct usb_driver alauda_driver = { .soft_unbind = 1, }; -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); diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c index c8447182118..c7909dfa243 100644 --- a/drivers/usb/storage/cypress_atacb.c +++ b/drivers/usb/storage/cypress_atacb.c @@ -274,15 +274,4 @@ static struct usb_driver cypress_driver = { .soft_unbind = 1, }; -static int __init cypress_init(void) -{ - return usb_register(&cypress_driver); -} - -static void __exit cypress_exit(void) -{ - usb_deregister(&cypress_driver); -} - -module_init(cypress_init); -module_exit(cypress_exit); +module_usb_driver(cypress_driver); diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index ded836b02d7..a99be857b79 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c @@ -753,15 +753,4 @@ static struct usb_driver datafab_driver = { .soft_unbind = 1, }; -static int __init datafab_init(void) -{ - return usb_register(&datafab_driver); -} - -static void __exit datafab_exit(void) -{ - usb_deregister(&datafab_driver); -} - -module_init(datafab_init); -module_exit(datafab_exit); +module_usb_driver(datafab_driver); diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c index 4dca3ef0668..5929f49d0b4 100644 --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c @@ -2410,15 +2410,4 @@ static struct usb_driver ene_ub6250_driver = { .soft_unbind = 1, }; -static int __init ene_ub6250_init(void) -{ - return usb_register(&ene_ub6250_driver); -} - -static void __exit ene_ub6250_exit(void) -{ - usb_deregister(&ene_ub6250_driver); -} - -module_init(ene_ub6250_init); -module_exit(ene_ub6250_exit); +module_usb_driver(ene_ub6250_driver); diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c index 6542ca40d50..03d4a873748 100644 --- a/drivers/usb/storage/freecom.c +++ b/drivers/usb/storage/freecom.c @@ -555,15 +555,4 @@ static struct usb_driver freecom_driver = { .soft_unbind = 1, }; -static int __init freecom_init(void) -{ - return usb_register(&freecom_driver); -} - -static void __exit freecom_exit(void) -{ - usb_deregister(&freecom_driver); -} - -module_init(freecom_init); -module_exit(freecom_exit); +module_usb_driver(freecom_driver); diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index ffc4193e950..6d6923317f1 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c @@ -1568,15 +1568,4 @@ static struct usb_driver isd200_driver = { .soft_unbind = 1, }; -static int __init isd200_init(void) -{ - return usb_register(&isd200_driver); -} - -static void __exit isd200_exit(void) -{ - usb_deregister(&isd200_driver); -} - -module_init(isd200_init); -module_exit(isd200_exit); +module_usb_driver(isd200_driver); diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 6168596c5ac..54b71650b69 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c @@ -679,15 +679,4 @@ static struct usb_driver jumpshot_driver = { .soft_unbind = 1, }; -static int __init jumpshot_init(void) -{ - return usb_register(&jumpshot_driver); -} - -static void __exit jumpshot_exit(void) -{ - usb_deregister(&jumpshot_driver); -} - -module_init(jumpshot_init); -module_exit(jumpshot_exit); +module_usb_driver(jumpshot_driver); diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c index ba1b7890688..35181e29124 100644 --- a/drivers/usb/storage/karma.c +++ b/drivers/usb/storage/karma.c @@ -232,15 +232,4 @@ static struct usb_driver karma_driver = { .soft_unbind = 1, }; -static int __init karma_init(void) -{ - return usb_register(&karma_driver); -} - -static void __exit karma_exit(void) -{ - usb_deregister(&karma_driver); -} - -module_init(karma_init); -module_exit(karma_exit); +module_usb_driver(karma_driver); diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index 1943be5a291..721c8c58730 100644 --- a/drivers/usb/storage/onetouch.c +++ b/drivers/usb/storage/onetouch.c @@ -314,15 +314,4 @@ static struct usb_driver onetouch_driver = { .soft_unbind = 1, }; -static int __init onetouch_init(void) -{ - return usb_register(&onetouch_driver); -} - -static void __exit onetouch_exit(void) -{ - usb_deregister(&onetouch_driver); -} - -module_init(onetouch_init); -module_exit(onetouch_exit); +module_usb_driver(onetouch_driver); diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 0ce5f79197e..c41cd30d2c0 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c @@ -1104,15 +1104,4 @@ static struct usb_driver realtek_cr_driver = { .supports_autosuspend = 1, }; -static int __init realtek_cr_init(void) -{ - return usb_register(&realtek_cr_driver); -} - -static void __exit realtek_cr_exit(void) -{ - usb_deregister(&realtek_cr_driver); -} - -module_init(realtek_cr_init); -module_exit(realtek_cr_exit); +module_usb_driver(realtek_cr_driver); diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c index bcb9a709d34..83ee49e737b 100644 --- a/drivers/usb/storage/sddr09.c +++ b/drivers/usb/storage/sddr09.c @@ -1789,15 +1789,4 @@ static struct usb_driver sddr09_driver = { .soft_unbind = 1, }; -static int __init sddr09_init(void) -{ - return usb_register(&sddr09_driver); -} - -static void __exit sddr09_exit(void) -{ - usb_deregister(&sddr09_driver); -} - -module_init(sddr09_init); -module_exit(sddr09_exit); +module_usb_driver(sddr09_driver); diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index 44dfed7754e..8983ec2ffb5 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c @@ -1008,15 +1008,4 @@ static struct usb_driver sddr55_driver = { .soft_unbind = 1, }; -static int __init sddr55_init(void) -{ - return usb_register(&sddr55_driver); -} - -static void __exit sddr55_exit(void) -{ - usb_deregister(&sddr55_driver); -} - -module_init(sddr55_init); -module_exit(sddr55_exit); +module_usb_driver(sddr55_driver); diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c index 0b00091d2ae..a4c02751af4 100644 --- a/drivers/usb/storage/shuttle_usbat.c +++ b/drivers/usb/storage/shuttle_usbat.c @@ -1865,15 +1865,4 @@ static struct usb_driver usbat_driver = { .soft_unbind = 1, }; -static int __init usbat_init(void) -{ - return usb_register(&usbat_driver); -} - -static void __exit usbat_exit(void) -{ - usb_deregister(&usbat_driver); -} - -module_init(usbat_init); -module_exit(usbat_exit); +module_usb_driver(usbat_driver); diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 1d10d5b8204..a33ead5dce2 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -760,18 +760,7 @@ static struct usb_driver uas_driver = { .id_table = uas_usb_ids, }; -static int uas_init(void) -{ - return usb_register(&uas_driver); -} - -static void uas_exit(void) -{ - usb_deregister(&uas_driver); -} - -module_init(uas_init); -module_exit(uas_exit); +module_usb_driver(uas_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Matthew Wilcox and Sarah Sharp"); diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index 32d6fc95390..5c6c1bdbd45 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c @@ -688,25 +688,6 @@ static struct usb_driver skel_driver = { .supports_autosuspend = 1, }; -static int __init usb_skel_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&skel_driver); - if (result) - err("usb_register failed. Error number %d", result); - - return result; -} - -static void __exit usb_skel_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&skel_driver); -} - -module_init(usb_skel_init); -module_exit(usb_skel_exit); +module_usb_driver(skel_driver); MODULE_LICENSE("GPL"); diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c index 200fd7c6c7d..7f78f300f8f 100644 --- a/drivers/usb/wusbcore/cbaf.c +++ b/drivers/usb/wusbcore/cbaf.c @@ -655,17 +655,7 @@ static struct usb_driver cbaf_driver = { .disconnect = cbaf_disconnect, }; -static int __init cbaf_driver_init(void) -{ - return usb_register(&cbaf_driver); -} -module_init(cbaf_driver_init); - -static void __exit cbaf_driver_exit(void) -{ - usb_deregister(&cbaf_driver); -} -module_exit(cbaf_driver_exit); +module_usb_driver(cbaf_driver); MODULE_AUTHOR("Inaky Perez-Gonzalez "); MODULE_DESCRIPTION("Wireless USB Cable Based Association"); -- cgit v1.2.3-70-g09d2 From c8d2a6f3999e175c4d564c445c7f1ececd926453 Mon Sep 17 00:00:00 2001 From: Alessandro Rubini Date: Fri, 18 Nov 2011 14:51:43 +0100 Subject: usb: dwc3: use debugfs_print_regs32() This a use example of the regs32 utilities in debugfs, although this fuse use ":" as separator between name and value, and debugs uses "=" (as it looked to me a more common practice). Signed-off-by: Alessandro Rubini Acked-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/debugfs.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index da1ad77d8d5..d9e7a26ee5f 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -51,18 +51,13 @@ #include "gadget.h" #include "io.h" -struct dwc3_register { - const char *name; - u32 offset; -}; - #define dump_register(nm) \ { \ .name = __stringify(nm), \ .offset = DWC3_ ##nm, \ } -static const struct dwc3_register dwc3_regs[] = { +static const struct debugfs_reg32 dwc3_regs[] = { dump_register(GSBUSCFG0), dump_register(GSBUSCFG1), dump_register(GTXTHRCFG), @@ -385,12 +380,8 @@ static int dwc3_regdump_show(struct seq_file *s, void *unused) int i; seq_printf(s, "DesignWare USB3 Core Register Dump\n"); - - for (i = 0; i < ARRAY_SIZE(dwc3_regs); i++) { - seq_printf(s, "%-20s : %08x\n", dwc3_regs[i].name, - dwc3_readl(dwc->regs, dwc3_regs[i].offset)); - } - + debugfs_print_regs32(s, dwc3_regs, ARRAY_SIZE(dwc3_regs), + dwc->regs, ""); return 0; } -- cgit v1.2.3-70-g09d2 From 42b4d114b936f3f7da121823774a42e584bf09f9 Mon Sep 17 00:00:00 2001 From: Alessandro Rubini Date: Fri, 18 Nov 2011 23:53:16 +0100 Subject: usb: dwc3: fix a warning The previous patch left an unused variable, I apologize. Signed-off-by: Alessandro Rubini Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/debugfs.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/usb') diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index d9e7a26ee5f..fcfa91517ea 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -377,7 +377,6 @@ static const struct debugfs_reg32 dwc3_regs[] = { static int dwc3_regdump_show(struct seq_file *s, void *unused) { struct dwc3 *dwc = s->private; - int i; seq_printf(s, "DesignWare USB3 Core Register Dump\n"); debugfs_print_regs32(s, dwc3_regs, ARRAY_SIZE(dwc3_regs), -- cgit v1.2.3-70-g09d2