USB: convert drivers/staging/* to use module_usb_driver()
authorGreg Kroah-Hartman <gregkh@suse.de>
Fri, 18 Nov 2011 17:42:11 +0000 (09:42 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 18 Nov 2011 17:42:11 +0000 (09:42 -0800)
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" <d@teklibre.com>
Cc: Marek Belisko <marek.belisko@gmail.com>
Cc: Al Cho <acho@novell.com>
Cc: Forest Bond <forest@alittletooquiet.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Huajun Li <huajun.li.lee@gmail.com>
Cc: Zac Storer <zac.3.14159@gmail.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: edwin_rong <edwin_rong@realsil.com.cn>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Julia Lawall <julia@diku.dk>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Joe Perches <joe@perches.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
13 files changed:
drivers/staging/frontier/alphatrack.c
drivers/staging/frontier/tranzport.c
drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
drivers/staging/keucr/usb.c
drivers/staging/media/go7007/go7007-usb.c
drivers/staging/media/lirc/lirc_igorplugusb.c
drivers/staging/media/lirc/lirc_imon.c
drivers/staging/media/lirc/lirc_sasem.c
drivers/staging/media/lirc/lirc_ttusbir.c
drivers/staging/rts5139/rts51x.c
drivers/staging/vt6656/main_usb.c
drivers/staging/winbond/wbusb.c
drivers/staging/wlan-ng/prism2usb.c

index 2babb03..d8efed6 100644 (file)
@@ -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);
index 8894ab1..c263284 100644 (file)
@@ -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);
index 79482ac..84c38d5 100644 (file)
@@ -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);
index 66aad3a..4833034 100644 (file)
@@ -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);
index 3db3b0a..b7175fe 100644 (file)
@@ -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);
index 0dc2c2b..6cd4cd6 100644 (file)
@@ -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 <linux/vermagic.h>
 MODULE_INFO(vermagic, VERMAGIC_STRING);
index f5308d5..f682180 100644 (file)
@@ -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);
index a2d18b0..7855baa 100644 (file)
@@ -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);
index e4b329b..7950887 100644 (file)
@@ -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);
index d9cee6d..2b9f785 100644 (file)
@@ -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);
index 27521b6..541f9aa 100644 (file)
@@ -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);
index f958eb4..c3751a7 100644 (file)
@@ -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);
index 4efa027..b1aed1f 100644 (file)
@@ -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);