From: Greg Kroah-Hartman Date: Fri, 18 Nov 2011 17:42:11 +0000 (-0800) Subject: USB: convert drivers/staging/* to use module_usb_driver() X-Git-Tag: v3.3-rc2~15^2~4^2~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bac2c126e452eb00f91305ba2c04a8b2bd95acf0;p=platform%2Fkernel%2Flinux-stable.git USB: convert drivers/staging/* to use module_usb_driver() This converts the drivers in drivers/staging/* 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: "David Täht" Cc: Marek Belisko Cc: Al Cho Cc: Forest Bond Cc: Pavel Machek Cc: Huajun Li Cc: Zac Storer Cc: Randy Dunlap Cc: Mauro Carvalho Chehab Cc: edwin_rong Cc: Ben Hutchings Cc: Julia Lawall Cc: Ilia Mirkin Cc: Joe Perches Cc: Pekka Enberg Cc: "John W. Linville" Cc: Paul Gortmaker Cc: Larry Finger Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c index 2babb03..d8efed6 100644 --- a/drivers/staging/frontier/alphatrack.c +++ b/drivers/staging/frontier/alphatrack.c @@ -867,30 +867,4 @@ static struct usb_driver usb_alphatrack_driver = { .id_table = usb_alphatrack_table, }; -/** - * usb_alphatrack_init - */ -static int __init usb_alphatrack_init(void) -{ - int retval; - - /* register this driver with the USB subsystem */ - retval = usb_register(&usb_alphatrack_driver); - if (retval) - err("usb_register failed for the " __FILE__ - " driver. Error number %d\n", retval); - - return retval; -} - -/** - * usb_alphatrack_exit - */ -static void __exit usb_alphatrack_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&usb_alphatrack_driver); -} - -module_init(usb_alphatrack_init); -module_exit(usb_alphatrack_exit); +module_usb_driver(usb_alphatrack_driver); diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c index 8894ab1..c263284 100644 --- a/drivers/staging/frontier/tranzport.c +++ b/drivers/staging/frontier/tranzport.c @@ -971,29 +971,4 @@ static struct usb_driver usb_tranzport_driver = { .id_table = usb_tranzport_table, }; -/** - * usb_tranzport_init - */ -static int __init usb_tranzport_init(void) -{ - int retval; - - /* register this driver with the USB subsystem */ - retval = usb_register(&usb_tranzport_driver); - if (retval) - err("usb_register failed for the " __FILE__ - " driver. Error number %d\n", retval); - return retval; -} -/** - * usb_tranzport_exit - */ - -static void __exit usb_tranzport_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&usb_tranzport_driver); -} - -module_init(usb_tranzport_init); -module_exit(usb_tranzport_exit); +module_usb_driver(usb_tranzport_driver); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index 79482ac..84c38d5 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -263,24 +263,4 @@ static struct usb_driver ft1000_usb_driver = { .id_table = id_table, }; -static int __init usb_ft1000_init(void) -{ - int ret = 0; - - DEBUG("Initialize and register the driver\n"); - - ret = usb_register(&ft1000_usb_driver); - if (ret) - err("usb_register failed. Error number %d", ret); - - return ret; -} - -static void __exit usb_ft1000_exit(void) -{ - DEBUG("Deregister the driver\n"); - usb_deregister(&ft1000_usb_driver); -} - -module_init(usb_ft1000_init); -module_exit(usb_ft1000_exit); +module_usb_driver(ft1000_usb_driver); diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c index 66aad3a..4833034 100644 --- a/drivers/staging/keucr/usb.c +++ b/drivers/staging/keucr/usb.c @@ -701,26 +701,4 @@ static struct usb_driver usb_storage_driver = { .soft_unbind = 1, }; -//----- usb_stor_init() --------------------- -static int __init usb_stor_init(void) -{ - int retval; - pr_info("usb --- usb_stor_init start\n"); - - retval = usb_register(&usb_storage_driver); - if (retval == 0) - pr_info("ENE USB Mass Storage support registered.\n"); - - return retval; -} - -//----- usb_stor_exit() --------------------- -static void __exit usb_stor_exit(void) -{ - pr_info("usb --- usb_stor_exit\n"); - - usb_deregister(&usb_storage_driver) ; -} - -module_init(usb_stor_init); -module_exit(usb_stor_exit); +module_usb_driver(usb_storage_driver); diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c index 3db3b0a..b7175fe 100644 --- a/drivers/staging/media/go7007/go7007-usb.c +++ b/drivers/staging/media/go7007/go7007-usb.c @@ -1272,17 +1272,4 @@ static struct usb_driver go7007_usb_driver = { .id_table = go7007_usb_id_table, }; -static int __init go7007_usb_init(void) -{ - return usb_register(&go7007_usb_driver); -} - -static void __exit go7007_usb_cleanup(void) -{ - usb_deregister(&go7007_usb_driver); -} - -module_init(go7007_usb_init); -module_exit(go7007_usb_cleanup); - -MODULE_LICENSE("GPL v2"); +module_usb_driver(go7007_usb_driver); diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c index 0dc2c2b..6cd4cd6 100644 --- a/drivers/staging/media/lirc/lirc_igorplugusb.c +++ b/drivers/staging/media/lirc/lirc_igorplugusb.c @@ -541,26 +541,7 @@ static struct usb_driver igorplugusb_remote_driver = { .id_table = igorplugusb_remote_id_table }; -static int __init igorplugusb_remote_init(void) -{ - int ret = 0; - - dprintk(DRIVER_NAME ": loaded, debug mode enabled\n"); - - ret = usb_register(&igorplugusb_remote_driver); - if (ret) - printk(KERN_ERR DRIVER_NAME ": usb register failed!\n"); - - return ret; -} - -static void __exit igorplugusb_remote_exit(void) -{ - usb_deregister(&igorplugusb_remote_driver); -} - -module_init(igorplugusb_remote_init); -module_exit(igorplugusb_remote_exit); +module_usb_driver(igorplugusb_remote_driver); #include MODULE_INFO(vermagic, VERMAGIC_STRING); diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c index f5308d5..f682180 100644 --- a/drivers/staging/media/lirc/lirc_imon.c +++ b/drivers/staging/media/lirc/lirc_imon.c @@ -1025,26 +1025,4 @@ static int imon_resume(struct usb_interface *intf) return rc; } -static int __init imon_init(void) -{ - int rc; - - printk(KERN_INFO MOD_NAME ": " MOD_DESC ", v" MOD_VERSION "\n"); - - rc = usb_register(&imon_driver); - if (rc) { - err("%s: usb register failed(%d)", __func__, rc); - return -ENODEV; - } - - return 0; -} - -static void __exit imon_exit(void) -{ - usb_deregister(&imon_driver); - printk(KERN_INFO MOD_NAME ": module removed. Goodbye!\n"); -} - -module_init(imon_init); -module_exit(imon_exit); +module_usb_driver(imon_driver); diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c index a2d18b0..7855baa 100644 --- a/drivers/staging/media/lirc/lirc_sasem.c +++ b/drivers/staging/media/lirc/lirc_sasem.c @@ -913,27 +913,4 @@ static void sasem_disconnect(struct usb_interface *interface) mutex_unlock(&disconnect_lock); } -static int __init sasem_init(void) -{ - int rc; - - printk(KERN_INFO MOD_DESC ", v" MOD_VERSION "\n"); - printk(KERN_INFO MOD_AUTHOR "\n"); - - rc = usb_register(&sasem_driver); - if (rc < 0) { - err("%s: usb register failed (%d)", __func__, rc); - return -ENODEV; - } - return 0; -} - -static void __exit sasem_exit(void) -{ - usb_deregister(&sasem_driver); - printk(KERN_INFO "module removed. Goodbye!\n"); -} - - -module_init(sasem_init); -module_exit(sasem_exit); +module_usb_driver(sasem_driver); diff --git a/drivers/staging/media/lirc/lirc_ttusbir.c b/drivers/staging/media/lirc/lirc_ttusbir.c index e4b329b..7950887 100644 --- a/drivers/staging/media/lirc/lirc_ttusbir.c +++ b/drivers/staging/media/lirc/lirc_ttusbir.c @@ -372,24 +372,4 @@ static void disconnect(struct usb_interface *intf) kfree(ttusbir); } -static int ttusbir_init_module(void) -{ - int result; - - DPRINTK(KERN_DEBUG "Module ttusbir init\n"); - - /* register this driver with the USB subsystem */ - result = usb_register(&usb_driver); - if (result) - err("usb_register failed. Error number %d", result); - return result; -} - -static void ttusbir_exit_module(void) -{ - printk(KERN_DEBUG "Module ttusbir exit\n"); - usb_deregister(&usb_driver); -} - -module_init(ttusbir_init_module); -module_exit(ttusbir_exit_module); +module_usb_driver(usb_driver); diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c index d9cee6d..2b9f785 100644 --- a/drivers/staging/rts5139/rts51x.c +++ b/drivers/staging/rts5139/rts51x.c @@ -934,34 +934,4 @@ struct usb_driver rts51x_driver = { .soft_unbind = 1, }; -static int __init rts51x_init(void) -{ - int retval; - - printk(KERN_INFO "Initializing %s USB card reader driver...\n", - RTS51X_NAME); - - /* register the driver, return usb_register return code if error */ - retval = usb_register(&rts51x_driver); - if (retval == 0) { - printk(KERN_INFO - "Realtek %s USB card reader support registered.\n", - RTS51X_NAME); - } - return retval; -} - -static void __exit rts51x_exit(void) -{ - RTS51X_DEBUGP("rts51x_exit() called\n"); - - /* Deregister the driver - * This will cause disconnect() to be called for each - * attached unit - */ - RTS51X_DEBUGP("-- calling usb_deregister()\n"); - usb_deregister(&rts51x_driver); -} - -module_init(rts51x_init); -module_exit(rts51x_exit); +module_usb_driver(rts51x_driver); diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 27521b6..541f9aa 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -2103,16 +2103,4 @@ static struct usb_driver vt6656_driver = { #endif /* CONFIG_PM */ }; -static int __init vt6656_init_module(void) -{ - printk(KERN_NOTICE DEVICE_FULL_DRV_NAM " " DEVICE_VERSION); - return usb_register(&vt6656_driver); -} - -static void __exit vt6656_cleanup_module(void) -{ - usb_deregister(&vt6656_driver); -} - -module_init(vt6656_init_module); -module_exit(vt6656_cleanup_module); +module_usb_driver(vt6656_driver); diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index f958eb4..c3751a7 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -865,15 +865,4 @@ static struct usb_driver wb35_driver = { .disconnect = wb35_disconnect, }; -static int __init wb35_init(void) -{ - return usb_register(&wb35_driver); -} - -static void __exit wb35_exit(void) -{ - usb_deregister(&wb35_driver); -} - -module_init(wb35_init); -module_exit(wb35_exit); +module_usb_driver(wb35_driver); diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index 4efa027..b1aed1f 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -358,16 +358,4 @@ static struct usb_driver prism2_usb_driver = { /* fops, minor? */ }; -static int __init prism2usb_init(void) -{ - /* This call will result in calls to prism2sta_probe_usb. */ - return usb_register(&prism2_usb_driver); -}; - -static void __exit prism2usb_cleanup(void) -{ - usb_deregister(&prism2_usb_driver); -}; - -module_init(prism2usb_init); -module_exit(prism2usb_cleanup); +module_usb_driver(prism2_usb_driver);