Skip to content

Commit bac2c12

Browse files
committed
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" <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>
1 parent 65db430 commit bac2c12

13 files changed

Lines changed: 13 additions & 268 deletions

File tree

‎drivers/staging/frontier/alphatrack.c‎

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -867,30 +867,4 @@ static struct usb_driver usb_alphatrack_driver = {
867867
.id_table = usb_alphatrack_table,
868868
};
869869

870-
/**
871-
* usb_alphatrack_init
872-
*/
873-
static int __init usb_alphatrack_init(void)
874-
{
875-
int retval;
876-
877-
/* register this driver with the USB subsystem */
878-
retval = usb_register(&usb_alphatrack_driver);
879-
if (retval)
880-
err("usb_register failed for the " __FILE__
881-
" driver. Error number %d\n", retval);
882-
883-
return retval;
884-
}
885-
886-
/**
887-
* usb_alphatrack_exit
888-
*/
889-
static void __exit usb_alphatrack_exit(void)
890-
{
891-
/* deregister this driver with the USB subsystem */
892-
usb_deregister(&usb_alphatrack_driver);
893-
}
894-
895-
module_init(usb_alphatrack_init);
896-
module_exit(usb_alphatrack_exit);
870+
module_usb_driver(usb_alphatrack_driver);

‎drivers/staging/frontier/tranzport.c‎

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -971,29 +971,4 @@ static struct usb_driver usb_tranzport_driver = {
971971
.id_table = usb_tranzport_table,
972972
};
973973

974-
/**
975-
* usb_tranzport_init
976-
*/
977-
static int __init usb_tranzport_init(void)
978-
{
979-
int retval;
980-
981-
/* register this driver with the USB subsystem */
982-
retval = usb_register(&usb_tranzport_driver);
983-
if (retval)
984-
err("usb_register failed for the " __FILE__
985-
" driver. Error number %d\n", retval);
986-
return retval;
987-
}
988-
/**
989-
* usb_tranzport_exit
990-
*/
991-
992-
static void __exit usb_tranzport_exit(void)
993-
{
994-
/* deregister this driver with the USB subsystem */
995-
usb_deregister(&usb_tranzport_driver);
996-
}
997-
998-
module_init(usb_tranzport_init);
999-
module_exit(usb_tranzport_exit);
974+
module_usb_driver(usb_tranzport_driver);

‎drivers/staging/ft1000/ft1000-usb/ft1000_usb.c‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -263,24 +263,4 @@ static struct usb_driver ft1000_usb_driver = {
263263
.id_table = id_table,
264264
};
265265

266-
static int __init usb_ft1000_init(void)
267-
{
268-
int ret = 0;
269-
270-
DEBUG("Initialize and register the driver\n");
271-
272-
ret = usb_register(&ft1000_usb_driver);
273-
if (ret)
274-
err("usb_register failed. Error number %d", ret);
275-
276-
return ret;
277-
}
278-
279-
static void __exit usb_ft1000_exit(void)
280-
{
281-
DEBUG("Deregister the driver\n");
282-
usb_deregister(&ft1000_usb_driver);
283-
}
284-
285-
module_init(usb_ft1000_init);
286-
module_exit(usb_ft1000_exit);
266+
module_usb_driver(ft1000_usb_driver);

‎drivers/staging/keucr/usb.c‎

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -701,26 +701,4 @@ static struct usb_driver usb_storage_driver = {
701701
.soft_unbind = 1,
702702
};
703703

704-
//----- usb_stor_init() ---------------------
705-
static int __init usb_stor_init(void)
706-
{
707-
int retval;
708-
pr_info("usb --- usb_stor_init start\n");
709-
710-
retval = usb_register(&usb_storage_driver);
711-
if (retval == 0)
712-
pr_info("ENE USB Mass Storage support registered.\n");
713-
714-
return retval;
715-
}
716-
717-
//----- usb_stor_exit() ---------------------
718-
static void __exit usb_stor_exit(void)
719-
{
720-
pr_info("usb --- usb_stor_exit\n");
721-
722-
usb_deregister(&usb_storage_driver) ;
723-
}
724-
725-
module_init(usb_stor_init);
726-
module_exit(usb_stor_exit);
704+
module_usb_driver(usb_storage_driver);

‎drivers/staging/media/go7007/go7007-usb.c‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,17 +1272,4 @@ static struct usb_driver go7007_usb_driver = {
12721272
.id_table = go7007_usb_id_table,
12731273
};
12741274

1275-
static int __init go7007_usb_init(void)
1276-
{
1277-
return usb_register(&go7007_usb_driver);
1278-
}
1279-
1280-
static void __exit go7007_usb_cleanup(void)
1281-
{
1282-
usb_deregister(&go7007_usb_driver);
1283-
}
1284-
1285-
module_init(go7007_usb_init);
1286-
module_exit(go7007_usb_cleanup);
1287-
1288-
MODULE_LICENSE("GPL v2");
1275+
module_usb_driver(go7007_usb_driver);

‎drivers/staging/media/lirc/lirc_igorplugusb.c‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -541,26 +541,7 @@ static struct usb_driver igorplugusb_remote_driver = {
541541
.id_table = igorplugusb_remote_id_table
542542
};
543543

544-
static int __init igorplugusb_remote_init(void)
545-
{
546-
int ret = 0;
547-
548-
dprintk(DRIVER_NAME ": loaded, debug mode enabled\n");
549-
550-
ret = usb_register(&igorplugusb_remote_driver);
551-
if (ret)
552-
printk(KERN_ERR DRIVER_NAME ": usb register failed!\n");
553-
554-
return ret;
555-
}
556-
557-
static void __exit igorplugusb_remote_exit(void)
558-
{
559-
usb_deregister(&igorplugusb_remote_driver);
560-
}
561-
562-
module_init(igorplugusb_remote_init);
563-
module_exit(igorplugusb_remote_exit);
544+
module_usb_driver(igorplugusb_remote_driver);
564545

565546
#include <linux/vermagic.h>
566547
MODULE_INFO(vermagic, VERMAGIC_STRING);

‎drivers/staging/media/lirc/lirc_imon.c‎

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,26 +1025,4 @@ static int imon_resume(struct usb_interface *intf)
10251025
return rc;
10261026
}
10271027

1028-
static int __init imon_init(void)
1029-
{
1030-
int rc;
1031-
1032-
printk(KERN_INFO MOD_NAME ": " MOD_DESC ", v" MOD_VERSION "\n");
1033-
1034-
rc = usb_register(&imon_driver);
1035-
if (rc) {
1036-
err("%s: usb register failed(%d)", __func__, rc);
1037-
return -ENODEV;
1038-
}
1039-
1040-
return 0;
1041-
}
1042-
1043-
static void __exit imon_exit(void)
1044-
{
1045-
usb_deregister(&imon_driver);
1046-
printk(KERN_INFO MOD_NAME ": module removed. Goodbye!\n");
1047-
}
1048-
1049-
module_init(imon_init);
1050-
module_exit(imon_exit);
1028+
module_usb_driver(imon_driver);

‎drivers/staging/media/lirc/lirc_sasem.c‎

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -913,27 +913,4 @@ static void sasem_disconnect(struct usb_interface *interface)
913913
mutex_unlock(&disconnect_lock);
914914
}
915915

916-
static int __init sasem_init(void)
917-
{
918-
int rc;
919-
920-
printk(KERN_INFO MOD_DESC ", v" MOD_VERSION "\n");
921-
printk(KERN_INFO MOD_AUTHOR "\n");
922-
923-
rc = usb_register(&sasem_driver);
924-
if (rc < 0) {
925-
err("%s: usb register failed (%d)", __func__, rc);
926-
return -ENODEV;
927-
}
928-
return 0;
929-
}
930-
931-
static void __exit sasem_exit(void)
932-
{
933-
usb_deregister(&sasem_driver);
934-
printk(KERN_INFO "module removed. Goodbye!\n");
935-
}
936-
937-
938-
module_init(sasem_init);
939-
module_exit(sasem_exit);
916+
module_usb_driver(sasem_driver);

‎drivers/staging/media/lirc/lirc_ttusbir.c‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -372,24 +372,4 @@ static void disconnect(struct usb_interface *intf)
372372
kfree(ttusbir);
373373
}
374374

375-
static int ttusbir_init_module(void)
376-
{
377-
int result;
378-
379-
DPRINTK(KERN_DEBUG "Module ttusbir init\n");
380-
381-
/* register this driver with the USB subsystem */
382-
result = usb_register(&usb_driver);
383-
if (result)
384-
err("usb_register failed. Error number %d", result);
385-
return result;
386-
}
387-
388-
static void ttusbir_exit_module(void)
389-
{
390-
printk(KERN_DEBUG "Module ttusbir exit\n");
391-
usb_deregister(&usb_driver);
392-
}
393-
394-
module_init(ttusbir_init_module);
395-
module_exit(ttusbir_exit_module);
375+
module_usb_driver(usb_driver);

‎drivers/staging/rts5139/rts51x.c‎

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -934,34 +934,4 @@ struct usb_driver rts51x_driver = {
934934
.soft_unbind = 1,
935935
};
936936

937-
static int __init rts51x_init(void)
938-
{
939-
int retval;
940-
941-
printk(KERN_INFO "Initializing %s USB card reader driver...\n",
942-
RTS51X_NAME);
943-
944-
/* register the driver, return usb_register return code if error */
945-
retval = usb_register(&rts51x_driver);
946-
if (retval == 0) {
947-
printk(KERN_INFO
948-
"Realtek %s USB card reader support registered.\n",
949-
RTS51X_NAME);
950-
}
951-
return retval;
952-
}
953-
954-
static void __exit rts51x_exit(void)
955-
{
956-
RTS51X_DEBUGP("rts51x_exit() called\n");
957-
958-
/* Deregister the driver
959-
* This will cause disconnect() to be called for each
960-
* attached unit
961-
*/
962-
RTS51X_DEBUGP("-- calling usb_deregister()\n");
963-
usb_deregister(&rts51x_driver);
964-
}
965-
966-
module_init(rts51x_init);
967-
module_exit(rts51x_exit);
937+
module_usb_driver(rts51x_driver);

0 commit comments

Comments
 (0)