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 2babb034a25417286c008da4512099818c77ab36..d8efed65744042ee1cc15994c3fddaf49de20b66 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 8894ab14f167755a242eda73b5465bb16aaa7b8c..c263284ddc0e74f6aa4cb8183ffe7811c24542cb 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 79482ac1c489814b1eacd29b57bfa6c56c3952f5..84c38d5c9397dc0ac31ac1a28a6047667f5eabb4 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 66aad3a0d1fd6b539d3f8310c333c00bec48da07..4833034027351cdadafbe2ee3ee954c8d7e6b914 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 3db3b0a91cc18e39c776d7519235aad085c08a8e..b7175fe1b15f9c6331f16971cf0dbaf8e7681d3f 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 0dc2c2b22c2bba290e1316482c8f53910bde7982..6cd4cd67a1ddcf1b6f7252fc0973e4b6030598eb 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 f5308d5929c69a35789f125f175a94da0a55111e..f68218012f231aab1f5fbe33953d140a8ff6a177 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 a2d18b0aa048c1da9833d16dcba27f90955e5f86..7855baa18e758d5ed3f71079412b7faa55c89901 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 e4b329b8cafd5ce274b6927ee60f33d567b38daa..7950887ff113b4c25be4d1845a0537162ee2c527 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 d9cee6d0b12462f419bef5728e8895ea1eab68e4..2b9f785954dfb0786901afa62adec30c22ecc496 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 27521b69ce0881f47970364cb76fed51d93922b4..541f9aa8ef6d6ad8f59d4fd2c3f84ee68ca86068 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 f958eb4f0d8146ffb18a667a295802b36b6fdb75..c3751a718384cf0f7821627482e6fab813b9c6e4 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 4efa027a81e444d70cb07d914a223d413640c323..b1aed1f1f749c28216b93e1b21e5e28ac830271a 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);