From d632eb1bf22e11def74e4e53cc47d790fbdba105 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 18 Nov 2011 09:44:20 -0800 Subject: USB: convert drivers/net/* to use module_usb_driver() This converts the drivers in drivers/net/* 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: Wolfgang Grandegger Cc: Samuel Ortiz Cc: Oliver Neukum Cc: Peter Korsgaard Cc: Petko Manolov Cc: Steve Glendinning Cc: Christian Lamparter Cc: "John W. Linville" Cc: Dan Williams Cc: Jussi Kivilinna Cc: Ivo van Doorn Cc: Gertjan van Wingerde Cc: Helmut Schaa Cc: Herton Ronaldo Krzesinski Cc: Hin-Tak Leung Cc: Larry Finger Cc: Chaoming Li Cc: Lucas De Marchi Cc: "David S. Miller" Cc: Roel Kluin Cc: Paul Gortmaker Cc: Jiri Pirko Cc: Pavel Roskin Cc: Yoann DI-RUZZA Cc: George Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/ems_usb.c | 26 +-------------------- drivers/net/can/usb/esd_usb2.c | 23 +------------------ drivers/net/irda/irda-usb.c | 35 +---------------------------- drivers/net/irda/kingsun-sir.c | 19 +--------------- drivers/net/irda/ks959-sir.c | 21 +---------------- drivers/net/irda/ksdazzle-sir.c | 21 +---------------- drivers/net/irda/mcs7780.c | 23 +------------------ drivers/net/irda/stir4200.c | 19 +--------------- drivers/net/usb/asix.c | 12 +--------- drivers/net/usb/catc.c | 17 +------------- drivers/net/usb/cdc-phonet.c | 13 +---------- drivers/net/usb/cdc_eem.c | 13 +---------- drivers/net/usb/cdc_ether.c | 19 ++++------------ drivers/net/usb/cdc_ncm.c | 15 +------------ drivers/net/usb/cdc_subset.c | 12 +--------- drivers/net/usb/cx82310_eth.c | 12 +--------- drivers/net/usb/dm9601.c | 13 +---------- drivers/net/usb/gl620a.c | 12 +--------- drivers/net/usb/int51x1.c | 12 +--------- drivers/net/usb/ipheth.c | 20 +---------------- drivers/net/usb/kalmia.c | 12 +--------- drivers/net/usb/kaweth.c | 30 +------------------------ drivers/net/usb/lg-vl600.c | 12 +--------- drivers/net/usb/mcs7830.c | 12 +--------- drivers/net/usb/net1080.c | 12 +--------- drivers/net/usb/plusb.c | 12 +--------- drivers/net/usb/rndis_host.c | 12 +--------- drivers/net/usb/rtl8150.c | 15 +------------ drivers/net/usb/sierra_net.c | 19 ++++------------ drivers/net/usb/smsc75xx.c | 12 +--------- drivers/net/usb/smsc95xx.c | 12 +--------- drivers/net/usb/zaurus.c | 12 +--------- drivers/net/wireless/ath/carl9170/usb.c | 13 +---------- drivers/net/wireless/libertas/if_usb.c | 24 +------------------- drivers/net/wireless/libertas_tf/if_usb.c | 22 +----------------- drivers/net/wireless/orinoco/orinoco_usb.c | 27 +--------------------- drivers/net/wireless/p54/p54usb.c | 13 +---------- drivers/net/wireless/rndis_wlan.c | 12 +--------- drivers/net/wireless/rt2x00/rt2500usb.c | 13 +---------- drivers/net/wireless/rt2x00/rt2800usb.c | 13 +---------- drivers/net/wireless/rt2x00/rt73usb.c | 13 +---------- drivers/net/wireless/rtl818x/rtl8187/dev.c | 13 +---------- drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 13 +---------- drivers/net/wireless/zd1201.c | 13 +---------- 44 files changed, 50 insertions(+), 668 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c index a72c7bfb4090..9697c14b8dc6 100644 --- a/drivers/net/can/usb/ems_usb.c +++ b/drivers/net/can/usb/ems_usb.c @@ -1115,28 +1115,4 @@ static struct usb_driver ems_usb_driver = { .id_table = ems_usb_table, }; -static int __init ems_usb_init(void) -{ - int err; - - printk(KERN_INFO "CPC-USB kernel driver loaded\n"); - - /* register this driver with the USB subsystem */ - err = usb_register(&ems_usb_driver); - - if (err) { - err("usb_register failed. Error number %d\n", err); - return err; - } - - return 0; -} - -static void __exit ems_usb_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&ems_usb_driver); -} - -module_init(ems_usb_init); -module_exit(ems_usb_exit); +module_usb_driver(ems_usb_driver); diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index eb8b0e600282..92774637aad8 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c @@ -1108,25 +1108,4 @@ static struct usb_driver esd_usb2_driver = { .id_table = esd_usb2_table, }; -static int __init esd_usb2_init(void) -{ - int err; - - /* register this driver with the USB subsystem */ - err = usb_register(&esd_usb2_driver); - - if (err) { - err("usb_register failed. Error number %d\n", err); - return err; - } - - return 0; -} -module_init(esd_usb2_init); - -static void __exit esd_usb2_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&esd_usb2_driver); -} -module_exit(esd_usb2_exit); +module_usb_driver(esd_usb2_driver); diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index d9267cb98a23..72f687b40d66 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -1914,41 +1914,8 @@ static struct usb_driver irda_driver = { #endif }; -/************************* MODULE CALLBACKS *************************/ -/* - * Deal with module insertion/removal - * Mostly tell USB about our existence - */ - -/*------------------------------------------------------------------*/ -/* - * Module insertion - */ -static int __init usb_irda_init(void) -{ - int ret; - - ret = usb_register(&irda_driver); - if (ret < 0) - return ret; - - IRDA_MESSAGE("USB IrDA support registered\n"); - return 0; -} -module_init(usb_irda_init); +module_usb_driver(irda_driver); -/*------------------------------------------------------------------*/ -/* - * Module removal - */ -static void __exit usb_irda_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} -module_exit(usb_irda_cleanup); - -/*------------------------------------------------------------------*/ /* * Module parameters */ diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c index cb90d640007a..79aebeee928c 100644 --- a/drivers/net/irda/kingsun-sir.c +++ b/drivers/net/irda/kingsun-sir.c @@ -621,24 +621,7 @@ static struct usb_driver irda_driver = { #endif }; -/* - * Module insertion - */ -static int __init kingsun_init(void) -{ - return usb_register(&irda_driver); -} -module_init(kingsun_init); - -/* - * Module removal - */ -static void __exit kingsun_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} -module_exit(kingsun_cleanup); +module_usb_driver(irda_driver); MODULE_AUTHOR("Alex Villacís Lasso "); MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun/DonShine"); diff --git a/drivers/net/irda/ks959-sir.c b/drivers/net/irda/ks959-sir.c index 1046014dd6c2..abe689dffc72 100644 --- a/drivers/net/irda/ks959-sir.c +++ b/drivers/net/irda/ks959-sir.c @@ -901,26 +901,7 @@ static struct usb_driver irda_driver = { #endif }; -/* - * Module insertion - */ -static int __init ks959_init(void) -{ - return usb_register(&irda_driver); -} - -module_init(ks959_init); - -/* - * Module removal - */ -static void __exit ks959_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} - -module_exit(ks959_cleanup); +module_usb_driver(irda_driver); MODULE_AUTHOR("Alex Villacís Lasso "); MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun KS-959"); diff --git a/drivers/net/irda/ksdazzle-sir.c b/drivers/net/irda/ksdazzle-sir.c index 9cc142fcc712..f8c01088eeb7 100644 --- a/drivers/net/irda/ksdazzle-sir.c +++ b/drivers/net/irda/ksdazzle-sir.c @@ -796,26 +796,7 @@ static struct usb_driver irda_driver = { #endif }; -/* - * Module insertion - */ -static int __init ksdazzle_init(void) -{ - return usb_register(&irda_driver); -} - -module_init(ksdazzle_init); - -/* - * Module removal - */ -static void __exit ksdazzle_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} - -module_exit(ksdazzle_cleanup); +module_usb_driver(irda_driver); MODULE_AUTHOR("Alex Villacís Lasso "); MODULE_DESCRIPTION("IrDA-USB Dongle Driver for KingSun Dazzle"); diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index be52bfed66a9..1a00b5990cb8 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c @@ -968,25 +968,4 @@ static void mcs_disconnect(struct usb_interface *intf) IRDA_DEBUG(0, "MCS7780 now disconnected.\n"); } -/* Module insertion */ -static int __init mcs_init(void) -{ - int result; - - /* register this driver with the USB subsystem */ - result = usb_register(&mcs_driver); - if (result) - IRDA_ERROR("usb_register failed. Error number %d\n", result); - - return result; -} -module_init(mcs_init); - -/* Module removal */ -static void __exit mcs_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&mcs_driver); -} -module_exit(mcs_exit); - +module_usb_driver(mcs_driver); diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index 41c96b3d8152..212868eb6f5f 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c @@ -1133,21 +1133,4 @@ static struct usb_driver irda_driver = { #endif }; -/* - * Module insertion - */ -static int __init stir_init(void) -{ - return usb_register(&irda_driver); -} -module_init(stir_init); - -/* - * Module removal - */ -static void __exit stir_cleanup(void) -{ - /* Deregister the driver and remove all pending instances */ - usb_deregister(&irda_driver); -} -module_exit(stir_cleanup); +module_usb_driver(irda_driver); diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index e81e22e3d1d2..97a1cc7ce684 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c @@ -1634,17 +1634,7 @@ static struct usb_driver asix_driver = { .supports_autosuspend = 1, }; -static int __init asix_init(void) -{ - return usb_register(&asix_driver); -} -module_init(asix_init); - -static void __exit asix_exit(void) -{ - usb_deregister(&asix_driver); -} -module_exit(asix_exit); +module_usb_driver(asix_driver); MODULE_AUTHOR("David Hollis"); MODULE_VERSION(DRIVER_VERSION); diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index a68272c93381..182cfb4aeb1d 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c @@ -949,19 +949,4 @@ static struct usb_driver catc_driver = { .id_table = catc_id_table, }; -static int __init catc_init(void) -{ - int result = usb_register(&catc_driver); - if (result == 0) - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return result; -} - -static void __exit catc_exit(void) -{ - usb_deregister(&catc_driver); -} - -module_init(catc_init); -module_exit(catc_exit); +module_usb_driver(catc_driver); diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c index a60d0069cc45..30aedcd55975 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c @@ -457,18 +457,7 @@ static struct usb_driver usbpn_driver = { .id_table = usbpn_ids, }; -static int __init usbpn_init(void) -{ - return usb_register(&usbpn_driver); -} - -static void __exit usbpn_exit(void) -{ - usb_deregister(&usbpn_driver); -} - -module_init(usbpn_init); -module_exit(usbpn_exit); +module_usb_driver(usbpn_driver); MODULE_AUTHOR("Remi Denis-Courmont"); MODULE_DESCRIPTION("USB CDC Phonet host interface"); diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c index 882f53f708df..439690be519f 100644 --- a/drivers/net/usb/cdc_eem.c +++ b/drivers/net/usb/cdc_eem.c @@ -369,18 +369,7 @@ static struct usb_driver eem_driver = { .resume = usbnet_resume, }; - -static int __init eem_init(void) -{ - return usb_register(&eem_driver); -} -module_init(eem_init); - -static void __exit eem_exit(void) -{ - usb_deregister(&eem_driver); -} -module_exit(eem_exit); +module_usb_driver(eem_driver); MODULE_AUTHOR("Omar Laazimani "); MODULE_DESCRIPTION("USB CDC EEM"); diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index c924ea2bce07..26637c354299 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c @@ -425,6 +425,9 @@ int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf) int status; struct cdc_state *info = (void *) &dev->data; + BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) + < sizeof(struct cdc_state))); + status = usbnet_generic_cdc_bind(dev, intf); if (status < 0) return status; @@ -615,21 +618,7 @@ static struct usb_driver cdc_driver = { .supports_autosuspend = 1, }; - -static int __init cdc_init(void) -{ - BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) - < sizeof(struct cdc_state))); - - return usb_register(&cdc_driver); -} -module_init(cdc_init); - -static void __exit cdc_exit(void) -{ - usb_deregister(&cdc_driver); -} -module_exit(cdc_exit); +module_usb_driver(cdc_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("USB CDC Ethernet devices"); diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index f06fb78383a1..9904b7ebca2d 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1232,20 +1232,7 @@ static struct ethtool_ops cdc_ncm_ethtool_ops = { .nway_reset = usbnet_nway_reset, }; -static int __init cdc_ncm_init(void) -{ - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION "\n"); - return usb_register(&cdc_ncm_driver); -} - -module_init(cdc_ncm_init); - -static void __exit cdc_ncm_exit(void) -{ - usb_deregister(&cdc_ncm_driver); -} - -module_exit(cdc_ncm_exit); +module_usb_driver(cdc_ncm_driver); MODULE_AUTHOR("Hans Petter Selasky"); MODULE_DESCRIPTION("USB CDC NCM host driver"); diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c index fc5f13d47ad9..b403d934e4e3 100644 --- a/drivers/net/usb/cdc_subset.c +++ b/drivers/net/usb/cdc_subset.c @@ -338,17 +338,7 @@ static struct usb_driver cdc_subset_driver = { .id_table = products, }; -static int __init cdc_subset_init(void) -{ - return usb_register(&cdc_subset_driver); -} -module_init(cdc_subset_init); - -static void __exit cdc_subset_exit(void) -{ - usb_deregister(&cdc_subset_driver); -} -module_exit(cdc_subset_exit); +module_usb_driver(cdc_subset_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("Simple 'CDC Subset' USB networking links"); diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c index 8969f124c18c..0e0531356e62 100644 --- a/drivers/net/usb/cx82310_eth.c +++ b/drivers/net/usb/cx82310_eth.c @@ -329,17 +329,7 @@ static struct usb_driver cx82310_driver = { .resume = usbnet_resume, }; -static int __init cx82310_init(void) -{ - return usb_register(&cx82310_driver); -} -module_init(cx82310_init); - -static void __exit cx82310_exit(void) -{ - usb_deregister(&cx82310_driver); -} -module_exit(cx82310_exit); +module_usb_driver(cx82310_driver); MODULE_AUTHOR("Ondrej Zary"); MODULE_DESCRIPTION("Conexant CX82310-based ADSL router USB ethernet driver"); diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index fbc0e4def767..b97226318ea5 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c @@ -672,18 +672,7 @@ static struct usb_driver dm9601_driver = { .resume = usbnet_resume, }; -static int __init dm9601_init(void) -{ - return usb_register(&dm9601_driver); -} - -static void __exit dm9601_exit(void) -{ - usb_deregister(&dm9601_driver); -} - -module_init(dm9601_init); -module_exit(dm9601_exit); +module_usb_driver(dm9601_driver); MODULE_AUTHOR("Peter Korsgaard "); MODULE_DESCRIPTION("Davicom DM9601 USB 1.1 ethernet devices"); diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c index c4cfd1dea881..38266bdae26b 100644 --- a/drivers/net/usb/gl620a.c +++ b/drivers/net/usb/gl620a.c @@ -227,17 +227,7 @@ static struct usb_driver gl620a_driver = { .resume = usbnet_resume, }; -static int __init usbnet_init(void) -{ - return usb_register(&gl620a_driver); -} -module_init(usbnet_init); - -static void __exit usbnet_exit(void) -{ - usb_deregister(&gl620a_driver); -} -module_exit(usbnet_exit); +module_usb_driver(gl620a_driver); MODULE_AUTHOR("Jiun-Jie Huang"); MODULE_DESCRIPTION("GL620-USB-A Host-to-Host Link cables"); diff --git a/drivers/net/usb/int51x1.c b/drivers/net/usb/int51x1.c index 131ac6c172f6..12a22a453ff1 100644 --- a/drivers/net/usb/int51x1.c +++ b/drivers/net/usb/int51x1.c @@ -238,17 +238,7 @@ static struct usb_driver int51x1_driver = { .resume = usbnet_resume, }; -static int __init int51x1_init(void) -{ - return usb_register(&int51x1_driver); -} -module_init(int51x1_init); - -static void __exit int51x1_exit(void) -{ - usb_deregister(&int51x1_driver); -} -module_exit(int51x1_exit); +module_usb_driver(int51x1_driver); MODULE_AUTHOR("Peter Holik"); MODULE_DESCRIPTION("Intellon usb powerline adapter"); diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index 13c1f044b40d..08a4df238796 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c @@ -543,25 +543,7 @@ static struct usb_driver ipheth_driver = { .id_table = ipheth_table, }; -static int __init ipheth_init(void) -{ - int retval; - - retval = usb_register(&ipheth_driver); - if (retval) { - err("usb_register failed: %d", retval); - return retval; - } - return 0; -} - -static void __exit ipheth_exit(void) -{ - usb_deregister(&ipheth_driver); -} - -module_init(ipheth_init); -module_exit(ipheth_exit); +module_usb_driver(ipheth_driver); MODULE_AUTHOR("Diego Giagio "); MODULE_DESCRIPTION("Apple iPhone USB Ethernet driver"); diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c index 5a6d0f88f43b..7562649b3d6b 100644 --- a/drivers/net/usb/kalmia.c +++ b/drivers/net/usb/kalmia.c @@ -375,17 +375,7 @@ static struct usb_driver kalmia_driver = { .resume = usbnet_resume }; -static int __init kalmia_init(void) -{ - return usb_register(&kalmia_driver); -} -module_init( kalmia_init); - -static void __exit kalmia_exit(void) -{ - usb_deregister(&kalmia_driver); -} -module_exit( kalmia_exit); +module_usb_driver(kalmia_driver); MODULE_AUTHOR("Marius Bjoernstad Kotsbak "); MODULE_DESCRIPTION("Samsung Kalmia USB network driver"); diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index 582ca2dfa5f9..d034d9c42548 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c @@ -1324,32 +1324,4 @@ static int kaweth_internal_control_msg(struct usb_device *usb_dev, } } - -/**************************************************************** - * kaweth_init - ****************************************************************/ -static int __init kaweth_init(void) -{ - dbg("Driver loading"); - return usb_register(&kaweth_driver); -} - -/**************************************************************** - * kaweth_exit - ****************************************************************/ -static void __exit kaweth_exit(void) -{ - usb_deregister(&kaweth_driver); -} - -module_init(kaweth_init); -module_exit(kaweth_exit); - - - - - - - - - +module_usb_driver(kaweth_driver); diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c index d43db32f9478..497db19f8cf8 100644 --- a/drivers/net/usb/lg-vl600.c +++ b/drivers/net/usb/lg-vl600.c @@ -349,17 +349,7 @@ static struct usb_driver lg_vl600_driver = { .resume = usbnet_resume, }; -static int __init vl600_init(void) -{ - return usb_register(&lg_vl600_driver); -} -module_init(vl600_init); - -static void __exit vl600_exit(void) -{ - usb_deregister(&lg_vl600_driver); -} -module_exit(vl600_exit); +module_usb_driver(lg_vl600_driver); MODULE_AUTHOR("Anrzej Zaborowski"); MODULE_DESCRIPTION("LG-VL600 modem's ethernet link"); diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c index db2cb74bf854..a29aa9cf9f6e 100644 --- a/drivers/net/usb/mcs7830.c +++ b/drivers/net/usb/mcs7830.c @@ -692,17 +692,7 @@ static struct usb_driver mcs7830_driver = { .reset_resume = mcs7830_reset_resume, }; -static int __init mcs7830_init(void) -{ - return usb_register(&mcs7830_driver); -} -module_init(mcs7830_init); - -static void __exit mcs7830_exit(void) -{ - usb_deregister(&mcs7830_driver); -} -module_exit(mcs7830_exit); +module_usb_driver(mcs7830_driver); MODULE_DESCRIPTION("USB to network adapter MCS7830)"); MODULE_LICENSE("GPL"); diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index 01db4602a39e..83f965cb69e7 100644 --- a/drivers/net/usb/net1080.c +++ b/drivers/net/usb/net1080.c @@ -589,17 +589,7 @@ static struct usb_driver net1080_driver = { .resume = usbnet_resume, }; -static int __init net1080_init(void) -{ - return usb_register(&net1080_driver); -} -module_init(net1080_init); - -static void __exit net1080_exit(void) -{ - usb_deregister(&net1080_driver); -} -module_exit(net1080_exit); +module_usb_driver(net1080_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("NetChip 1080 based USB Host-to-Host Links"); diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c index 217aec8a768f..b2b035e29978 100644 --- a/drivers/net/usb/plusb.c +++ b/drivers/net/usb/plusb.c @@ -154,17 +154,7 @@ static struct usb_driver plusb_driver = { .resume = usbnet_resume, }; -static int __init plusb_init(void) -{ - return usb_register(&plusb_driver); -} -module_init(plusb_init); - -static void __exit plusb_exit(void) -{ - usb_deregister(&plusb_driver); -} -module_exit(plusb_exit); +module_usb_driver(plusb_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("Prolific PL-2301/2302/25A1 USB Host to Host Link Driver"); diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index 255d6a424a6b..c8f1b5b3aff3 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c @@ -635,17 +635,7 @@ static struct usb_driver rndis_driver = { .resume = usbnet_resume, }; -static int __init rndis_init(void) -{ - return usb_register(&rndis_driver); -} -module_init(rndis_init); - -static void __exit rndis_exit(void) -{ - usb_deregister(&rndis_driver); -} -module_exit(rndis_exit); +module_usb_driver(rndis_driver); MODULE_AUTHOR("David Brownell"); MODULE_DESCRIPTION("USB Host side RNDIS driver"); diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index bf8c84d0adf2..0710b4ca9252 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c @@ -978,20 +978,7 @@ static struct usb_driver rtl8150_driver = { .resume = rtl8150_resume }; -static int __init usb_rtl8150_init(void) -{ - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" - DRIVER_DESC "\n"); - return usb_register(&rtl8150_driver); -} - -static void __exit usb_rtl8150_exit(void) -{ - usb_deregister(&rtl8150_driver); -} - -module_init(usb_rtl8150_init); -module_exit(usb_rtl8150_exit); +module_usb_driver(rtl8150_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c index ed1b43210584..e45dfdcb8718 100644 --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c @@ -900,6 +900,9 @@ struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev, struct sk_buff *skb, u16 len; bool need_tail; + BUILD_BUG_ON(FIELD_SIZEOF(struct usbnet, data) + < sizeof(struct cdc_state)); + dev_dbg(&dev->udev->dev, "%s", __func__); if (priv->link_up && check_ethip_packet(skb, dev) && is_ip(skb)) { /* enough head room as is? */ @@ -981,21 +984,7 @@ static struct usb_driver sierra_net_driver = { .no_dynamic_id = 1, }; -static int __init sierra_net_init(void) -{ - BUILD_BUG_ON(FIELD_SIZEOF(struct usbnet, data) - < sizeof(struct cdc_state)); - - return usb_register(&sierra_net_driver); -} - -static void __exit sierra_net_exit(void) -{ - usb_deregister(&sierra_net_driver); -} - -module_exit(sierra_net_exit); -module_init(sierra_net_init); +module_usb_driver(sierra_net_driver); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 22a7cf951e72..9741b24f0668 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c @@ -1236,17 +1236,7 @@ static struct usb_driver smsc75xx_driver = { .disconnect = usbnet_disconnect, }; -static int __init smsc75xx_init(void) -{ - return usb_register(&smsc75xx_driver); -} -module_init(smsc75xx_init); - -static void __exit smsc75xx_exit(void) -{ - usb_deregister(&smsc75xx_driver); -} -module_exit(smsc75xx_exit); +module_usb_driver(smsc75xx_driver); MODULE_AUTHOR("Nancy Lin"); MODULE_AUTHOR("Steve Glendinning "); diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index eff67678c5a6..4a107610ac43 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1297,17 +1297,7 @@ static struct usb_driver smsc95xx_driver = { .disconnect = usbnet_disconnect, }; -static int __init smsc95xx_init(void) -{ - return usb_register(&smsc95xx_driver); -} -module_init(smsc95xx_init); - -static void __exit smsc95xx_exit(void) -{ - usb_deregister(&smsc95xx_driver); -} -module_exit(smsc95xx_exit); +module_usb_driver(smsc95xx_driver); MODULE_AUTHOR("Nancy Lin"); MODULE_AUTHOR("Steve Glendinning "); diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c index 1a2234c20514..f701d4127087 100644 --- a/drivers/net/usb/zaurus.c +++ b/drivers/net/usb/zaurus.c @@ -362,17 +362,7 @@ static struct usb_driver zaurus_driver = { .resume = usbnet_resume, }; -static int __init zaurus_init(void) -{ - return usb_register(&zaurus_driver); -} -module_init(zaurus_init); - -static void __exit zaurus_exit(void) -{ - usb_deregister(&zaurus_driver); -} -module_exit(zaurus_exit); +module_usb_driver(zaurus_driver); MODULE_AUTHOR("Pavel Machek, David Brownell"); MODULE_DESCRIPTION("Sharp Zaurus PDA, and compatible products"); diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c index 333b69ef2ae2..89821e4835c7 100644 --- a/drivers/net/wireless/ath/carl9170/usb.c +++ b/drivers/net/wireless/ath/carl9170/usb.c @@ -1161,15 +1161,4 @@ static struct usb_driver carl9170_driver = { #endif /* CONFIG_PM */ }; -static int __init carl9170_usb_init(void) -{ - return usb_register(&carl9170_driver); -} - -static void __exit carl9170_usb_exit(void) -{ - usb_deregister(&carl9170_driver); -} - -module_init(carl9170_usb_init); -module_exit(carl9170_usb_exit); +module_usb_driver(carl9170_driver); diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index db879c364ebf..b5fbbc7947df 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c @@ -1184,29 +1184,7 @@ static struct usb_driver if_usb_driver = { .reset_resume = if_usb_resume, }; -static int __init if_usb_init_module(void) -{ - int ret = 0; - - lbs_deb_enter(LBS_DEB_MAIN); - - ret = usb_register(&if_usb_driver); - - lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret); - return ret; -} - -static void __exit if_usb_exit_module(void) -{ - lbs_deb_enter(LBS_DEB_MAIN); - - usb_deregister(&if_usb_driver); - - lbs_deb_leave(LBS_DEB_MAIN); -} - -module_init(if_usb_init_module); -module_exit(if_usb_exit_module); +module_usb_driver(if_usb_driver); MODULE_DESCRIPTION("8388 USB WLAN Driver"); MODULE_AUTHOR("Marvell International Ltd. and Red Hat, Inc."); diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c index 68202e63873a..aff8b5743af0 100644 --- a/drivers/net/wireless/libertas_tf/if_usb.c +++ b/drivers/net/wireless/libertas_tf/if_usb.c @@ -924,27 +924,7 @@ static struct usb_driver if_usb_driver = { .resume = if_usb_resume, }; -static int __init if_usb_init_module(void) -{ - int ret = 0; - - lbtf_deb_enter(LBTF_DEB_MAIN); - - ret = usb_register(&if_usb_driver); - - lbtf_deb_leave_args(LBTF_DEB_MAIN, "ret %d", ret); - return ret; -} - -static void __exit if_usb_exit_module(void) -{ - lbtf_deb_enter(LBTF_DEB_MAIN); - usb_deregister(&if_usb_driver); - lbtf_deb_leave(LBTF_DEB_MAIN); -} - -module_init(if_usb_init_module); -module_exit(if_usb_exit_module); +module_usb_driver(if_usb_driver); MODULE_DESCRIPTION("8388 USB WLAN Thinfirm Driver"); MODULE_AUTHOR("Cozybit Inc."); diff --git a/drivers/net/wireless/orinoco/orinoco_usb.c b/drivers/net/wireless/orinoco/orinoco_usb.c index 0793e4265b43..ae8ce56670b6 100644 --- a/drivers/net/wireless/orinoco/orinoco_usb.c +++ b/drivers/net/wireless/orinoco/orinoco_usb.c @@ -1759,32 +1759,7 @@ static struct usb_driver orinoco_driver = { static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION " (Manuel Estrada Sainz)"; -static int __init ezusb_module_init(void) -{ - int err; - - printk(KERN_DEBUG "%s\n", version); - - /* register this driver with the USB subsystem */ - err = usb_register(&orinoco_driver); - if (err < 0) { - printk(KERN_ERR PFX "usb_register failed, error %d\n", - err); - return err; - } - - return 0; -} - -static void __exit ezusb_module_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&orinoco_driver); -} - - -module_init(ezusb_module_init); -module_exit(ezusb_module_exit); +module_usb_driver(orinoco_driver); MODULE_AUTHOR("Manuel Estrada Sainz"); MODULE_DESCRIPTION("Driver for Orinoco wireless LAN cards using EZUSB bridge"); diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 9b6096866427..f4d28c39aac7 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c @@ -1083,15 +1083,4 @@ static struct usb_driver p54u_driver = { .soft_unbind = 1, }; -static int __init p54u_init(void) -{ - return usb_register(&p54u_driver); -} - -static void __exit p54u_exit(void) -{ - usb_deregister(&p54u_driver); -} - -module_init(p54u_init); -module_exit(p54u_exit); +module_usb_driver(p54u_driver); diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 0c13840a7de5..85370a7dfa8b 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c @@ -3754,17 +3754,7 @@ static struct usb_driver rndis_wlan_driver = { .resume = usbnet_resume, }; -static int __init rndis_wlan_init(void) -{ - return usb_register(&rndis_wlan_driver); -} -module_init(rndis_wlan_init); - -static void __exit rndis_wlan_exit(void) -{ - usb_deregister(&rndis_wlan_driver); -} -module_exit(rndis_wlan_exit); +module_usb_driver(rndis_wlan_driver); MODULE_AUTHOR("Bjorge Dijkstra"); MODULE_AUTHOR("Jussi Kivilinna"); diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 53c5f878f61d..b31f38d41a47 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c @@ -1982,15 +1982,4 @@ static struct usb_driver rt2500usb_driver = { .resume = rt2x00usb_resume, }; -static int __init rt2500usb_init(void) -{ - return usb_register(&rt2500usb_driver); -} - -static void __exit rt2500usb_exit(void) -{ - usb_deregister(&rt2500usb_driver); -} - -module_init(rt2500usb_init); -module_exit(rt2500usb_exit); +module_usb_driver(rt2500usb_driver); diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index f1565792f270..78550a7f689c 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c @@ -1233,15 +1233,4 @@ static struct usb_driver rt2800usb_driver = { .resume = rt2x00usb_resume, }; -static int __init rt2800usb_init(void) -{ - return usb_register(&rt2800usb_driver); -} - -static void __exit rt2800usb_exit(void) -{ - usb_deregister(&rt2800usb_driver); -} - -module_init(rt2800usb_init); -module_exit(rt2800usb_exit); +module_usb_driver(rt2800usb_driver); diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index cfb19dbb0a67..0e5a10179182 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c @@ -2528,15 +2528,4 @@ static struct usb_driver rt73usb_driver = { .resume = rt2x00usb_resume, }; -static int __init rt73usb_init(void) -{ - return usb_register(&rt73usb_driver); -} - -static void __exit rt73usb_exit(void) -{ - usb_deregister(&rt73usb_driver); -} - -module_init(rt73usb_init); -module_exit(rt73usb_exit); +module_usb_driver(rt73usb_driver); diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c index 4a78f9e39dfa..638fbef693e6 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c @@ -1592,15 +1592,4 @@ static struct usb_driver rtl8187_driver = { .disconnect = __devexit_p(rtl8187_disconnect), }; -static int __init rtl8187_init(void) -{ - return usb_register(&rtl8187_driver); -} - -static void __exit rtl8187_exit(void) -{ - usb_deregister(&rtl8187_driver); -} - -module_init(rtl8187_init); -module_exit(rtl8187_exit); +module_usb_driver(rtl8187_driver); diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index c244f2f1b83f..674cd1a486c5 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c @@ -356,15 +356,4 @@ static struct usb_driver rtl8192cu_driver = { #endif }; -static int __init rtl8192cu_init(void) -{ - return usb_register(&rtl8192cu_driver); -} - -static void __exit rtl8192cu_exit(void) -{ - usb_deregister(&rtl8192cu_driver); -} - -module_init(rtl8192cu_init); -module_exit(rtl8192cu_exit); +module_usb_driver(rtl8192cu_driver); diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c index 8efa2f2d9579..a66b93b7ff9a 100644 --- a/drivers/net/wireless/zd1201.c +++ b/drivers/net/wireless/zd1201.c @@ -1907,15 +1907,4 @@ static struct usb_driver zd1201_usb = { .resume = zd1201_resume, }; -static int __init zd1201_init(void) -{ - return usb_register(&zd1201_usb); -} - -static void __exit zd1201_cleanup(void) -{ - usb_deregister(&zd1201_usb); -} - -module_init(zd1201_init); -module_exit(zd1201_cleanup); +module_usb_driver(zd1201_usb); -- cgit v1.2.3