aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-02-23 14:56:17 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-24 15:39:17 -0500
commit08a4f6bc2e7046ce50849d7589b7d0763926d808 (patch)
tree9c2f247154db1872ef71e9c5ec8afbdd87e02b83
parent765e0ba62613fb90f09c1b5926750df0aa56f349 (diff)
usb-serial: use new registration API in [a-c]* drivers
This patch (as1523) modifies the following usb-serial drivers to utilize the new usb_serial_{de}register_drivers() routines: aircable, ark3116, belkin_sa, ch341, cp210x, cyberjack, and cypress_m8. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/aircable.c23
-rw-r--r--drivers/usb/serial/ark3116.c17
-rw-r--r--drivers/usb/serial/belkin_sa.c26
-rw-r--r--drivers/usb/serial/ch341.c19
-rw-r--r--drivers/usb/serial/cp210x.c29
-rw-r--r--drivers/usb/serial/cyberjack.c29
-rw-r--r--drivers/usb/serial/cypress_m8.c42
7 files changed, 60 insertions, 125 deletions
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 123bf9155339..dbf3bddc1b51 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -175,7 +175,6 @@ static struct usb_driver aircable_driver = {
175 .probe = usb_serial_probe, 175 .probe = usb_serial_probe,
176 .disconnect = usb_serial_disconnect, 176 .disconnect = usb_serial_disconnect,
177 .id_table = id_table, 177 .id_table = id_table,
178 .no_dynamic_id = 1,
179}; 178};
180 179
181static struct usb_serial_driver aircable_device = { 180static struct usb_serial_driver aircable_device = {
@@ -183,7 +182,6 @@ static struct usb_serial_driver aircable_device = {
183 .owner = THIS_MODULE, 182 .owner = THIS_MODULE,
184 .name = "aircable", 183 .name = "aircable",
185 }, 184 },
186 .usb_driver = &aircable_driver,
187 .id_table = id_table, 185 .id_table = id_table,
188 .num_ports = 1, 186 .num_ports = 1,
189 .bulk_out_size = HCI_COMPLETE_FRAME, 187 .bulk_out_size = HCI_COMPLETE_FRAME,
@@ -194,27 +192,18 @@ static struct usb_serial_driver aircable_device = {
194 .unthrottle = usb_serial_generic_unthrottle, 192 .unthrottle = usb_serial_generic_unthrottle,
195}; 193};
196 194
195static struct usb_serial_driver * const serial_drivers[] = {
196 &aircable_device, NULL
197};
198
197static int __init aircable_init(void) 199static int __init aircable_init(void)
198{ 200{
199 int retval; 201 return usb_serial_register_drivers(&aircable_driver, serial_drivers);
200 retval = usb_serial_register(&aircable_device);
201 if (retval)
202 goto failed_serial_register;
203 retval = usb_register(&aircable_driver);
204 if (retval)
205 goto failed_usb_register;
206 return 0;
207
208failed_usb_register:
209 usb_serial_deregister(&aircable_device);
210failed_serial_register:
211 return retval;
212} 202}
213 203
214static void __exit aircable_exit(void) 204static void __exit aircable_exit(void)
215{ 205{
216 usb_deregister(&aircable_driver); 206 usb_serial_deregister_drivers(&aircable_driver, serial_drivers);
217 usb_serial_deregister(&aircable_device);
218} 207}
219 208
220MODULE_AUTHOR(DRIVER_AUTHOR); 209MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 69328dcfd91a..ab2cf1165c60 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -719,7 +719,6 @@ static struct usb_driver ark3116_driver = {
719 .probe = usb_serial_probe, 719 .probe = usb_serial_probe,
720 .disconnect = usb_serial_disconnect, 720 .disconnect = usb_serial_disconnect,
721 .id_table = id_table, 721 .id_table = id_table,
722 .no_dynamic_id = 1,
723}; 722};
724 723
725static struct usb_serial_driver ark3116_device = { 724static struct usb_serial_driver ark3116_device = {
@@ -728,7 +727,6 @@ static struct usb_serial_driver ark3116_device = {
728 .name = "ark3116", 727 .name = "ark3116",
729 }, 728 },
730 .id_table = id_table, 729 .id_table = id_table,
731 .usb_driver = &ark3116_driver,
732 .num_ports = 1, 730 .num_ports = 1,
733 .attach = ark3116_attach, 731 .attach = ark3116_attach,
734 .release = ark3116_release, 732 .release = ark3116_release,
@@ -745,28 +743,27 @@ static struct usb_serial_driver ark3116_device = {
745 .process_read_urb = ark3116_process_read_urb, 743 .process_read_urb = ark3116_process_read_urb,
746}; 744};
747 745
746static struct usb_serial_driver * const serial_drivers[] = {
747 &ark3116_device, NULL
748};
749
748static int __init ark3116_init(void) 750static int __init ark3116_init(void)
749{ 751{
750 int retval; 752 int retval;
751 753
752 retval = usb_serial_register(&ark3116_device); 754 retval = usb_serial_register_drivers(&ark3116_driver, serial_drivers);
753 if (retval)
754 return retval;
755 retval = usb_register(&ark3116_driver);
756 if (retval == 0) { 755 if (retval == 0) {
757 printk(KERN_INFO "%s:" 756 printk(KERN_INFO "%s:"
758 DRIVER_VERSION ":" 757 DRIVER_VERSION ":"
759 DRIVER_DESC "\n", 758 DRIVER_DESC "\n",
760 KBUILD_MODNAME); 759 KBUILD_MODNAME);
761 } else 760 }
762 usb_serial_deregister(&ark3116_device);
763 return retval; 761 return retval;
764} 762}
765 763
766static void __exit ark3116_exit(void) 764static void __exit ark3116_exit(void)
767{ 765{
768 usb_deregister(&ark3116_driver); 766 usb_serial_deregister_drivers(&ark3116_driver, serial_drivers);
769 usb_serial_deregister(&ark3116_device);
770} 767}
771 768
772module_init(ark3116_init); 769module_init(ark3116_init);
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 29ffeb6279c7..e8b473f5acf7 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -78,7 +78,6 @@ static struct usb_driver belkin_driver = {
78 .probe = usb_serial_probe, 78 .probe = usb_serial_probe,
79 .disconnect = usb_serial_disconnect, 79 .disconnect = usb_serial_disconnect,
80 .id_table = id_table_combined, 80 .id_table = id_table_combined,
81 .no_dynamic_id = 1,
82}; 81};
83 82
84/* All of the device info needed for the serial converters */ 83/* All of the device info needed for the serial converters */
@@ -88,7 +87,6 @@ static struct usb_serial_driver belkin_device = {
88 .name = "belkin", 87 .name = "belkin",
89 }, 88 },
90 .description = "Belkin / Peracom / GoHubs USB Serial Adapter", 89 .description = "Belkin / Peracom / GoHubs USB Serial Adapter",
91 .usb_driver = &belkin_driver,
92 .id_table = id_table_combined, 90 .id_table = id_table_combined,
93 .num_ports = 1, 91 .num_ports = 1,
94 .open = belkin_sa_open, 92 .open = belkin_sa_open,
@@ -103,6 +101,10 @@ static struct usb_serial_driver belkin_device = {
103 .release = belkin_sa_release, 101 .release = belkin_sa_release,
104}; 102};
105 103
104static struct usb_serial_driver * const serial_drivers[] = {
105 &belkin_device, NULL
106};
107
106struct belkin_sa_private { 108struct belkin_sa_private {
107 spinlock_t lock; 109 spinlock_t lock;
108 unsigned long control_state; 110 unsigned long control_state;
@@ -526,25 +528,17 @@ exit:
526static int __init belkin_sa_init(void) 528static int __init belkin_sa_init(void)
527{ 529{
528 int retval; 530 int retval;
529 retval = usb_serial_register(&belkin_device); 531
530 if (retval) 532 retval = usb_serial_register_drivers(&belkin_driver, serial_drivers);
531 goto failed_usb_serial_register; 533 if (retval == 0)
532 retval = usb_register(&belkin_driver); 534 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
533 if (retval) 535 DRIVER_DESC "\n");
534 goto failed_usb_register;
535 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
536 DRIVER_DESC "\n");
537 return 0;
538failed_usb_register:
539 usb_serial_deregister(&belkin_device);
540failed_usb_serial_register:
541 return retval; 536 return retval;
542} 537}
543 538
544static void __exit belkin_sa_exit (void) 539static void __exit belkin_sa_exit (void)
545{ 540{
546 usb_deregister(&belkin_driver); 541 usb_serial_deregister_drivers(&belkin_driver, serial_drivers);
547 usb_serial_deregister(&belkin_device);
548} 542}
549 543
550 544
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 5e53cc59e652..23de3b039a28 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -625,7 +625,6 @@ static struct usb_driver ch341_driver = {
625 .resume = usb_serial_resume, 625 .resume = usb_serial_resume,
626 .reset_resume = ch341_reset_resume, 626 .reset_resume = ch341_reset_resume,
627 .id_table = id_table, 627 .id_table = id_table,
628 .no_dynamic_id = 1,
629 .supports_autosuspend = 1, 628 .supports_autosuspend = 1,
630}; 629};
631 630
@@ -635,7 +634,6 @@ static struct usb_serial_driver ch341_device = {
635 .name = "ch341-uart", 634 .name = "ch341-uart",
636 }, 635 },
637 .id_table = id_table, 636 .id_table = id_table,
638 .usb_driver = &ch341_driver,
639 .num_ports = 1, 637 .num_ports = 1,
640 .open = ch341_open, 638 .open = ch341_open,
641 .dtr_rts = ch341_dtr_rts, 639 .dtr_rts = ch341_dtr_rts,
@@ -650,23 +648,18 @@ static struct usb_serial_driver ch341_device = {
650 .attach = ch341_attach, 648 .attach = ch341_attach,
651}; 649};
652 650
651static struct usb_serial_driver * const serial_drivers[] = {
652 &ch341_device, NULL
653};
654
653static int __init ch341_init(void) 655static int __init ch341_init(void)
654{ 656{
655 int retval; 657 return usb_serial_register_drivers(&ch341_driver, serial_drivers);
656
657 retval = usb_serial_register(&ch341_device);
658 if (retval)
659 return retval;
660 retval = usb_register(&ch341_driver);
661 if (retval)
662 usb_serial_deregister(&ch341_device);
663 return retval;
664} 658}
665 659
666static void __exit ch341_exit(void) 660static void __exit ch341_exit(void)
667{ 661{
668 usb_deregister(&ch341_driver); 662 usb_serial_deregister_drivers(&ch341_driver, serial_drivers);
669 usb_serial_deregister(&ch341_device);
670} 663}
671 664
672module_init(ch341_init); 665module_init(ch341_init);
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index ec9dc4e9a3ff..01a9374357f1 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -154,7 +154,6 @@ static struct usb_driver cp210x_driver = {
154 .probe = usb_serial_probe, 154 .probe = usb_serial_probe,
155 .disconnect = usb_serial_disconnect, 155 .disconnect = usb_serial_disconnect,
156 .id_table = id_table, 156 .id_table = id_table,
157 .no_dynamic_id = 1,
158}; 157};
159 158
160static struct usb_serial_driver cp210x_device = { 159static struct usb_serial_driver cp210x_device = {
@@ -162,7 +161,6 @@ static struct usb_serial_driver cp210x_device = {
162 .owner = THIS_MODULE, 161 .owner = THIS_MODULE,
163 .name = "cp210x", 162 .name = "cp210x",
164 }, 163 },
165 .usb_driver = &cp210x_driver,
166 .id_table = id_table, 164 .id_table = id_table,
167 .num_ports = 1, 165 .num_ports = 1,
168 .bulk_in_size = 256, 166 .bulk_in_size = 256,
@@ -177,6 +175,10 @@ static struct usb_serial_driver cp210x_device = {
177 .dtr_rts = cp210x_dtr_rts 175 .dtr_rts = cp210x_dtr_rts
178}; 176};
179 177
178static struct usb_serial_driver * const serial_drivers[] = {
179 &cp210x_device, NULL
180};
181
180/* Config request types */ 182/* Config request types */
181#define REQTYPE_HOST_TO_DEVICE 0x41 183#define REQTYPE_HOST_TO_DEVICE 0x41
182#define REQTYPE_DEVICE_TO_HOST 0xc1 184#define REQTYPE_DEVICE_TO_HOST 0xc1
@@ -852,27 +854,16 @@ static int __init cp210x_init(void)
852{ 854{
853 int retval; 855 int retval;
854 856
855 retval = usb_serial_register(&cp210x_device); 857 retval = usb_serial_register_drivers(&cp210x_driver, serial_drivers);
856 if (retval) 858 if (retval == 0)
857 return retval; /* Failed to register */ 859 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
858 860 DRIVER_DESC "\n");
859 retval = usb_register(&cp210x_driver); 861 return retval;
860 if (retval) {
861 /* Failed to register */
862 usb_serial_deregister(&cp210x_device);
863 return retval;
864 }
865
866 /* Success */
867 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
868 DRIVER_DESC "\n");
869 return 0;
870} 862}
871 863
872static void __exit cp210x_exit(void) 864static void __exit cp210x_exit(void)
873{ 865{
874 usb_deregister(&cp210x_driver); 866 usb_serial_deregister_drivers(&cp210x_driver, serial_drivers);
875 usb_serial_deregister(&cp210x_device);
876} 867}
877 868
878module_init(cp210x_init); 869module_init(cp210x_init);
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index 6bc3802a581a..d2e536f649ba 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -82,7 +82,6 @@ static struct usb_driver cyberjack_driver = {
82 .probe = usb_serial_probe, 82 .probe = usb_serial_probe,
83 .disconnect = usb_serial_disconnect, 83 .disconnect = usb_serial_disconnect,
84 .id_table = id_table, 84 .id_table = id_table,
85 .no_dynamic_id = 1,
86}; 85};
87 86
88static struct usb_serial_driver cyberjack_device = { 87static struct usb_serial_driver cyberjack_device = {
@@ -91,7 +90,6 @@ static struct usb_serial_driver cyberjack_device = {
91 .name = "cyberjack", 90 .name = "cyberjack",
92 }, 91 },
93 .description = "Reiner SCT Cyberjack USB card reader", 92 .description = "Reiner SCT Cyberjack USB card reader",
94 .usb_driver = &cyberjack_driver,
95 .id_table = id_table, 93 .id_table = id_table,
96 .num_ports = 1, 94 .num_ports = 1,
97 .attach = cyberjack_startup, 95 .attach = cyberjack_startup,
@@ -106,6 +104,10 @@ static struct usb_serial_driver cyberjack_device = {
106 .write_bulk_callback = cyberjack_write_bulk_callback, 104 .write_bulk_callback = cyberjack_write_bulk_callback,
107}; 105};
108 106
107static struct usb_serial_driver * const serial_drivers[] = {
108 &cyberjack_device, NULL
109};
110
109struct cyberjack_private { 111struct cyberjack_private {
110 spinlock_t lock; /* Lock for SMP */ 112 spinlock_t lock; /* Lock for SMP */
111 short rdtodo; /* Bytes still to read */ 113 short rdtodo; /* Bytes still to read */
@@ -476,28 +478,19 @@ exit:
476static int __init cyberjack_init(void) 478static int __init cyberjack_init(void)
477{ 479{
478 int retval; 480 int retval;
479 retval = usb_serial_register(&cyberjack_device);
480 if (retval)
481 goto failed_usb_serial_register;
482 retval = usb_register(&cyberjack_driver);
483 if (retval)
484 goto failed_usb_register;
485
486 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION " "
487 DRIVER_AUTHOR "\n");
488 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
489 481
490 return 0; 482 retval = usb_serial_register_drivers(&cyberjack_driver, serial_drivers);
491failed_usb_register: 483 if (retval == 0) {
492 usb_serial_deregister(&cyberjack_device); 484 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION " "
493failed_usb_serial_register: 485 DRIVER_AUTHOR "\n");
486 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
487 }
494 return retval; 488 return retval;
495} 489}
496 490
497static void __exit cyberjack_exit(void) 491static void __exit cyberjack_exit(void)
498{ 492{
499 usb_deregister(&cyberjack_driver); 493 usb_serial_deregister_drivers(&cyberjack_driver, serial_drivers);
500 usb_serial_deregister(&cyberjack_device);
501} 494}
502 495
503module_init(cyberjack_init); 496module_init(cyberjack_init);
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 5ae86b349cad..bc5057513d5d 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -94,7 +94,6 @@ static struct usb_driver cypress_driver = {
94 .probe = usb_serial_probe, 94 .probe = usb_serial_probe,
95 .disconnect = usb_serial_disconnect, 95 .disconnect = usb_serial_disconnect,
96 .id_table = id_table_combined, 96 .id_table = id_table_combined,
97 .no_dynamic_id = 1,
98}; 97};
99 98
100enum packet_format { 99enum packet_format {
@@ -163,7 +162,6 @@ static struct usb_serial_driver cypress_earthmate_device = {
163 .name = "earthmate", 162 .name = "earthmate",
164 }, 163 },
165 .description = "DeLorme Earthmate USB", 164 .description = "DeLorme Earthmate USB",
166 .usb_driver = &cypress_driver,
167 .id_table = id_table_earthmate, 165 .id_table = id_table_earthmate,
168 .num_ports = 1, 166 .num_ports = 1,
169 .attach = cypress_earthmate_startup, 167 .attach = cypress_earthmate_startup,
@@ -190,7 +188,6 @@ static struct usb_serial_driver cypress_hidcom_device = {
190 .name = "cyphidcom", 188 .name = "cyphidcom",
191 }, 189 },
192 .description = "HID->COM RS232 Adapter", 190 .description = "HID->COM RS232 Adapter",
193 .usb_driver = &cypress_driver,
194 .id_table = id_table_cyphidcomrs232, 191 .id_table = id_table_cyphidcomrs232,
195 .num_ports = 1, 192 .num_ports = 1,
196 .attach = cypress_hidcom_startup, 193 .attach = cypress_hidcom_startup,
@@ -217,7 +214,6 @@ static struct usb_serial_driver cypress_ca42v2_device = {
217 .name = "nokiaca42v2", 214 .name = "nokiaca42v2",
218 }, 215 },
219 .description = "Nokia CA-42 V2 Adapter", 216 .description = "Nokia CA-42 V2 Adapter",
220 .usb_driver = &cypress_driver,
221 .id_table = id_table_nokiaca42v2, 217 .id_table = id_table_nokiaca42v2,
222 .num_ports = 1, 218 .num_ports = 1,
223 .attach = cypress_ca42v2_startup, 219 .attach = cypress_ca42v2_startup,
@@ -238,6 +234,11 @@ static struct usb_serial_driver cypress_ca42v2_device = {
238 .write_int_callback = cypress_write_int_callback, 234 .write_int_callback = cypress_write_int_callback,
239}; 235};
240 236
237static struct usb_serial_driver * const serial_drivers[] = {
238 &cypress_earthmate_device, &cypress_hidcom_device,
239 &cypress_ca42v2_device, NULL
240};
241
241/***************************************************************************** 242/*****************************************************************************
242 * Cypress serial helper functions 243 * Cypress serial helper functions
243 *****************************************************************************/ 244 *****************************************************************************/
@@ -1356,30 +1357,10 @@ static int __init cypress_init(void)
1356 1357
1357 dbg("%s", __func__); 1358 dbg("%s", __func__);
1358 1359
1359 retval = usb_serial_register(&cypress_earthmate_device); 1360 retval = usb_serial_register_drivers(&cypress_driver, serial_drivers);
1360 if (retval) 1361 if (retval == 0)
1361 goto failed_em_register; 1362 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1362 retval = usb_serial_register(&cypress_hidcom_device); 1363 DRIVER_DESC "\n");
1363 if (retval)
1364 goto failed_hidcom_register;
1365 retval = usb_serial_register(&cypress_ca42v2_device);
1366 if (retval)
1367 goto failed_ca42v2_register;
1368 retval = usb_register(&cypress_driver);
1369 if (retval)
1370 goto failed_usb_register;
1371
1372 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1373 DRIVER_DESC "\n");
1374 return 0;
1375
1376failed_usb_register:
1377 usb_serial_deregister(&cypress_ca42v2_device);
1378failed_ca42v2_register:
1379 usb_serial_deregister(&cypress_hidcom_device);
1380failed_hidcom_register:
1381 usb_serial_deregister(&cypress_earthmate_device);
1382failed_em_register:
1383 return retval; 1364 return retval;
1384} 1365}
1385 1366
@@ -1388,10 +1369,7 @@ static void __exit cypress_exit(void)
1388{ 1369{
1389 dbg("%s", __func__); 1370 dbg("%s", __func__);
1390 1371
1391 usb_deregister(&cypress_driver); 1372 usb_serial_deregister_drivers(&cypress_driver, serial_drivers);
1392 usb_serial_deregister(&cypress_earthmate_device);
1393 usb_serial_deregister(&cypress_hidcom_device);
1394 usb_serial_deregister(&cypress_ca42v2_device);
1395} 1373}
1396 1374
1397 1375