aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-02-23 14:57:25 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-24 15:39:20 -0500
commitd860322f34e4a53f347b1aeae23d5b72f1e91b8c (patch)
treebea8d4ab22b81eed98ab67c82a994b73cb6c5763 /drivers/usb/serial
parentf667ddad41e303ebc2c6d5bf3105dffe2fbdd717 (diff)
usb-serial: use new registration API in [q-s]* drivers
This patch (as1528) modifies the following usb-serial drivers to utilize the new usb_serial_{de}register_drivers() routines: qcaux, qcserial, safe_serial, siemens_mpi, sierra, spcp8x5, ssu100, and symbolserial. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/qcaux.c19
-rw-r--r--drivers/usb/serial/qcserial.c22
-rw-r--r--drivers/usb/serial/safe_serial.c24
-rw-r--r--drivers/usb/serial/siemens_mpi.c26
-rw-r--r--drivers/usb/serial/sierra.c29
-rw-r--r--drivers/usb/serial/spcp8x5.c26
-rw-r--r--drivers/usb/serial/ssu100.c31
-rw-r--r--drivers/usb/serial/symbolserial.c19
8 files changed, 64 insertions, 132 deletions
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c
index a34819884c1a..a2ce274b3f28 100644
--- a/drivers/usb/serial/qcaux.c
+++ b/drivers/usb/serial/qcaux.c
@@ -82,7 +82,6 @@ static struct usb_driver qcaux_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 qcaux_device = { 87static struct usb_serial_driver qcaux_device = {
@@ -91,27 +90,21 @@ static struct usb_serial_driver qcaux_device = {
91 .name = "qcaux", 90 .name = "qcaux",
92 }, 91 },
93 .id_table = id_table, 92 .id_table = id_table,
94 .usb_driver = &qcaux_driver,
95 .num_ports = 1, 93 .num_ports = 1,
96}; 94};
97 95
96static struct usb_serial_driver * const serial_drivers[] = {
97 &qcaux_device, NULL
98};
99
98static int __init qcaux_init(void) 100static int __init qcaux_init(void)
99{ 101{
100 int retval; 102 return usb_serial_register_drivers(&qcaux_driver, serial_drivers);
101
102 retval = usb_serial_register(&qcaux_device);
103 if (retval)
104 return retval;
105 retval = usb_register(&qcaux_driver);
106 if (retval)
107 usb_serial_deregister(&qcaux_device);
108 return retval;
109} 103}
110 104
111static void __exit qcaux_exit(void) 105static void __exit qcaux_exit(void)
112{ 106{
113 usb_deregister(&qcaux_driver); 107 usb_serial_deregister_drivers(&qcaux_driver, serial_drivers);
114 usb_serial_deregister(&qcaux_device);
115} 108}
116 109
117module_init(qcaux_init); 110module_init(qcaux_init);
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index f98800f2324c..70e9f1abdad1 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -246,7 +246,6 @@ static struct usb_serial_driver qcdevice = {
246 }, 246 },
247 .description = "Qualcomm USB modem", 247 .description = "Qualcomm USB modem",
248 .id_table = id_table, 248 .id_table = id_table,
249 .usb_driver = &qcdriver,
250 .num_ports = 1, 249 .num_ports = 1,
251 .probe = qcprobe, 250 .probe = qcprobe,
252 .open = usb_wwan_open, 251 .open = usb_wwan_open,
@@ -263,27 +262,18 @@ static struct usb_serial_driver qcdevice = {
263#endif 262#endif
264}; 263};
265 264
265static struct usb_serial_driver * const serial_drivers[] = {
266 &qcdevice, NULL
267};
268
266static int __init qcinit(void) 269static int __init qcinit(void)
267{ 270{
268 int retval; 271 return usb_serial_register_drivers(&qcdriver, serial_drivers);
269
270 retval = usb_serial_register(&qcdevice);
271 if (retval)
272 return retval;
273
274 retval = usb_register(&qcdriver);
275 if (retval) {
276 usb_serial_deregister(&qcdevice);
277 return retval;
278 }
279
280 return 0;
281} 272}
282 273
283static void __exit qcexit(void) 274static void __exit qcexit(void)
284{ 275{
285 usb_deregister(&qcdriver); 276 usb_serial_deregister_drivers(&qcdriver, serial_drivers);
286 usb_serial_deregister(&qcdevice);
287} 277}
288 278
289module_init(qcinit); 279module_init(qcinit);
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index d074b3740dcb..ae4ee30c7411 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -156,7 +156,6 @@ static struct usb_driver safe_driver = {
156 .probe = usb_serial_probe, 156 .probe = usb_serial_probe,
157 .disconnect = usb_serial_disconnect, 157 .disconnect = usb_serial_disconnect,
158 .id_table = id_table, 158 .id_table = id_table,
159 .no_dynamic_id = 1,
160}; 159};
161 160
162static const __u16 crc10_table[256] = { 161static const __u16 crc10_table[256] = {
@@ -309,16 +308,19 @@ static struct usb_serial_driver safe_device = {
309 .name = "safe_serial", 308 .name = "safe_serial",
310 }, 309 },
311 .id_table = id_table, 310 .id_table = id_table,
312 .usb_driver = &safe_driver,
313 .num_ports = 1, 311 .num_ports = 1,
314 .process_read_urb = safe_process_read_urb, 312 .process_read_urb = safe_process_read_urb,
315 .prepare_write_buffer = safe_prepare_write_buffer, 313 .prepare_write_buffer = safe_prepare_write_buffer,
316 .attach = safe_startup, 314 .attach = safe_startup,
317}; 315};
318 316
317static struct usb_serial_driver * const serial_drivers[] = {
318 &safe_device, NULL
319};
320
319static int __init safe_init(void) 321static int __init safe_init(void)
320{ 322{
321 int i, retval; 323 int i;
322 324
323 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" 325 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
324 DRIVER_DESC "\n"); 326 DRIVER_DESC "\n");
@@ -337,24 +339,12 @@ static int __init safe_init(void)
337 } 339 }
338 } 340 }
339 341
340 retval = usb_serial_register(&safe_device); 342 return usb_serial_register_drivers(&safe_driver, serial_drivers);
341 if (retval)
342 goto failed_usb_serial_register;
343 retval = usb_register(&safe_driver);
344 if (retval)
345 goto failed_usb_register;
346
347 return 0;
348failed_usb_register:
349 usb_serial_deregister(&safe_device);
350failed_usb_serial_register:
351 return retval;
352} 343}
353 344
354static void __exit safe_exit(void) 345static void __exit safe_exit(void)
355{ 346{
356 usb_deregister(&safe_driver); 347 usb_serial_deregister_drivers(&safe_driver, serial_drivers);
357 usb_serial_deregister(&safe_device);
358} 348}
359 349
360module_init(safe_init); 350module_init(safe_init);
diff --git a/drivers/usb/serial/siemens_mpi.c b/drivers/usb/serial/siemens_mpi.c
index 74cd4ccdb3fc..8aa4c1aef6d1 100644
--- a/drivers/usb/serial/siemens_mpi.c
+++ b/drivers/usb/serial/siemens_mpi.c
@@ -42,33 +42,29 @@ static struct usb_serial_driver siemens_usb_mpi_device = {
42 .name = "siemens_mpi", 42 .name = "siemens_mpi",
43 }, 43 },
44 .id_table = id_table, 44 .id_table = id_table,
45 .usb_driver = &siemens_usb_mpi_driver,
46 .num_ports = 1, 45 .num_ports = 1,
47}; 46};
48 47
48static struct usb_serial_driver * const serial_drivers[] = {
49 &siemens_usb_mpi_device, NULL
50};
51
49static int __init siemens_usb_mpi_init(void) 52static int __init siemens_usb_mpi_init(void)
50{ 53{
51 int retval; 54 int retval;
52 55
53 retval = usb_serial_register(&siemens_usb_mpi_device); 56 retval = usb_serial_register_drivers(&siemens_usb_mpi_driver,
54 if (retval) 57 serial_drivers);
55 goto failed_usb_serial_register; 58 if (retval == 0) {
56 retval = usb_register(&siemens_usb_mpi_driver); 59 printk(KERN_INFO DRIVER_DESC "\n");
57 if (retval) 60 printk(KERN_INFO DRIVER_VERSION " " DRIVER_AUTHOR "\n");
58 goto failed_usb_register; 61 }
59 printk(KERN_INFO DRIVER_DESC "\n");
60 printk(KERN_INFO DRIVER_VERSION " " DRIVER_AUTHOR "\n");
61 return retval;
62failed_usb_register:
63 usb_serial_deregister(&siemens_usb_mpi_device);
64failed_usb_serial_register:
65 return retval; 62 return retval;
66} 63}
67 64
68static void __exit siemens_usb_mpi_exit(void) 65static void __exit siemens_usb_mpi_exit(void)
69{ 66{
70 usb_deregister(&siemens_usb_mpi_driver); 67 usb_serial_deregister_drivers(&siemens_usb_mpi_driver, serial_drivers);
71 usb_serial_deregister(&siemens_usb_mpi_device);
72} 68}
73 69
74module_init(siemens_usb_mpi_init); 70module_init(siemens_usb_mpi_init);
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index fdae0a4407cb..d75a75b83e9f 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -1084,7 +1084,6 @@ static struct usb_driver sierra_driver = {
1084 .resume = usb_serial_resume, 1084 .resume = usb_serial_resume,
1085 .reset_resume = sierra_reset_resume, 1085 .reset_resume = sierra_reset_resume,
1086 .id_table = id_table, 1086 .id_table = id_table,
1087 .no_dynamic_id = 1,
1088 .supports_autosuspend = 1, 1087 .supports_autosuspend = 1,
1089}; 1088};
1090 1089
@@ -1095,7 +1094,6 @@ static struct usb_serial_driver sierra_device = {
1095 }, 1094 },
1096 .description = "Sierra USB modem", 1095 .description = "Sierra USB modem",
1097 .id_table = id_table, 1096 .id_table = id_table,
1098 .usb_driver = &sierra_driver,
1099 .calc_num_ports = sierra_calc_num_ports, 1097 .calc_num_ports = sierra_calc_num_ports,
1100 .probe = sierra_probe, 1098 .probe = sierra_probe,
1101 .open = sierra_open, 1099 .open = sierra_open,
@@ -1113,34 +1111,25 @@ static struct usb_serial_driver sierra_device = {
1113 .read_int_callback = sierra_instat_callback, 1111 .read_int_callback = sierra_instat_callback,
1114}; 1112};
1115 1113
1114static struct usb_serial_driver * const serial_drivers[] = {
1115 &sierra_device, NULL
1116};
1117
1116/* Functions used by new usb-serial code. */ 1118/* Functions used by new usb-serial code. */
1117static int __init sierra_init(void) 1119static int __init sierra_init(void)
1118{ 1120{
1119 int retval; 1121 int retval;
1120 retval = usb_serial_register(&sierra_device);
1121 if (retval)
1122 goto failed_device_register;
1123
1124
1125 retval = usb_register(&sierra_driver);
1126 if (retval)
1127 goto failed_driver_register;
1128
1129 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1130 DRIVER_DESC "\n");
1131
1132 return 0;
1133 1122
1134failed_driver_register: 1123 retval = usb_serial_register_drivers(&sierra_driver, serial_drivers);
1135 usb_serial_deregister(&sierra_device); 1124 if (retval == 0)
1136failed_device_register: 1125 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1126 DRIVER_DESC "\n");
1137 return retval; 1127 return retval;
1138} 1128}
1139 1129
1140static void __exit sierra_exit(void) 1130static void __exit sierra_exit(void)
1141{ 1131{
1142 usb_deregister(&sierra_driver); 1132 usb_serial_deregister_drivers(&sierra_driver, serial_drivers);
1143 usb_serial_deregister(&sierra_device);
1144} 1133}
1145 1134
1146module_init(sierra_init); 1135module_init(sierra_init);
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index d7f5eee18f00..af898937d4b1 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -156,7 +156,6 @@ static struct usb_driver spcp8x5_driver = {
156 .probe = usb_serial_probe, 156 .probe = usb_serial_probe,
157 .disconnect = usb_serial_disconnect, 157 .disconnect = usb_serial_disconnect,
158 .id_table = id_table, 158 .id_table = id_table,
159 .no_dynamic_id = 1,
160}; 159};
161 160
162 161
@@ -649,7 +648,6 @@ static struct usb_serial_driver spcp8x5_device = {
649 .name = "SPCP8x5", 648 .name = "SPCP8x5",
650 }, 649 },
651 .id_table = id_table, 650 .id_table = id_table,
652 .usb_driver = &spcp8x5_driver,
653 .num_ports = 1, 651 .num_ports = 1,
654 .open = spcp8x5_open, 652 .open = spcp8x5_open,
655 .dtr_rts = spcp8x5_dtr_rts, 653 .dtr_rts = spcp8x5_dtr_rts,
@@ -664,28 +662,24 @@ static struct usb_serial_driver spcp8x5_device = {
664 .process_read_urb = spcp8x5_process_read_urb, 662 .process_read_urb = spcp8x5_process_read_urb,
665}; 663};
666 664
665static struct usb_serial_driver * const serial_drivers[] = {
666 &spcp8x5_device, NULL
667};
668
667static int __init spcp8x5_init(void) 669static int __init spcp8x5_init(void)
668{ 670{
669 int retval; 671 int retval;
670 retval = usb_serial_register(&spcp8x5_device); 672
671 if (retval) 673 retval = usb_serial_register_drivers(&spcp8x5_driver, serial_drivers);
672 goto failed_usb_serial_register; 674 if (retval == 0)
673 retval = usb_register(&spcp8x5_driver); 675 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
674 if (retval) 676 DRIVER_DESC "\n");
675 goto failed_usb_register;
676 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
677 DRIVER_DESC "\n");
678 return 0;
679failed_usb_register:
680 usb_serial_deregister(&spcp8x5_device);
681failed_usb_serial_register:
682 return retval; 677 return retval;
683} 678}
684 679
685static void __exit spcp8x5_exit(void) 680static void __exit spcp8x5_exit(void)
686{ 681{
687 usb_deregister(&spcp8x5_driver); 682 usb_serial_deregister_drivers(&spcp8x5_driver, serial_drivers);
688 usb_serial_deregister(&spcp8x5_device);
689} 683}
690 684
691module_init(spcp8x5_init); 685module_init(spcp8x5_init);
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
index 7697858d8858..ab8842107a8b 100644
--- a/drivers/usb/serial/ssu100.c
+++ b/drivers/usb/serial/ssu100.c
@@ -70,7 +70,6 @@ static struct usb_driver ssu100_driver = {
70 .id_table = id_table, 70 .id_table = id_table,
71 .suspend = usb_serial_suspend, 71 .suspend = usb_serial_suspend,
72 .resume = usb_serial_resume, 72 .resume = usb_serial_resume,
73 .no_dynamic_id = 1,
74 .supports_autosuspend = 1, 73 .supports_autosuspend = 1,
75}; 74};
76 75
@@ -677,7 +676,6 @@ static struct usb_serial_driver ssu100_device = {
677 }, 676 },
678 .description = DRIVER_DESC, 677 .description = DRIVER_DESC,
679 .id_table = id_table, 678 .id_table = id_table,
680 .usb_driver = &ssu100_driver,
681 .num_ports = 1, 679 .num_ports = 1,
682 .open = ssu100_open, 680 .open = ssu100_open,
683 .close = ssu100_close, 681 .close = ssu100_close,
@@ -693,37 +691,26 @@ static struct usb_serial_driver ssu100_device = {
693 .disconnect = usb_serial_generic_disconnect, 691 .disconnect = usb_serial_generic_disconnect,
694}; 692};
695 693
694static struct usb_serial_driver * const serial_drivers[] = {
695 &ssu100_device, NULL
696};
697
696static int __init ssu100_init(void) 698static int __init ssu100_init(void)
697{ 699{
698 int retval; 700 int retval;
699 701
700 dbg("%s", __func__); 702 dbg("%s", __func__);
701 703
702 /* register with usb-serial */ 704 retval = usb_serial_register_drivers(&ssu100_driver, serial_drivers);
703 retval = usb_serial_register(&ssu100_device); 705 if (retval == 0)
704 706 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
705 if (retval) 707 DRIVER_DESC "\n");
706 goto failed_usb_sio_register;
707
708 retval = usb_register(&ssu100_driver);
709 if (retval)
710 goto failed_usb_register;
711
712 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
713 DRIVER_DESC "\n");
714
715 return 0;
716
717failed_usb_register:
718 usb_serial_deregister(&ssu100_device);
719failed_usb_sio_register:
720 return retval; 708 return retval;
721} 709}
722 710
723static void __exit ssu100_exit(void) 711static void __exit ssu100_exit(void)
724{ 712{
725 usb_deregister(&ssu100_driver); 713 usb_serial_deregister_drivers(&ssu100_driver, serial_drivers);
726 usb_serial_deregister(&ssu100_device);
727} 714}
728 715
729module_init(ssu100_init); 716module_init(ssu100_init);
diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
index 50651cf4fc61..76cd9f2a08c0 100644
--- a/drivers/usb/serial/symbolserial.c
+++ b/drivers/usb/serial/symbolserial.c
@@ -287,7 +287,6 @@ static struct usb_driver symbol_driver = {
287 .probe = usb_serial_probe, 287 .probe = usb_serial_probe,
288 .disconnect = usb_serial_disconnect, 288 .disconnect = usb_serial_disconnect,
289 .id_table = id_table, 289 .id_table = id_table,
290 .no_dynamic_id = 1,
291}; 290};
292 291
293static struct usb_serial_driver symbol_device = { 292static struct usb_serial_driver symbol_device = {
@@ -296,7 +295,6 @@ static struct usb_serial_driver symbol_device = {
296 .name = "symbol", 295 .name = "symbol",
297 }, 296 },
298 .id_table = id_table, 297 .id_table = id_table,
299 .usb_driver = &symbol_driver,
300 .num_ports = 1, 298 .num_ports = 1,
301 .attach = symbol_startup, 299 .attach = symbol_startup,
302 .open = symbol_open, 300 .open = symbol_open,
@@ -307,23 +305,18 @@ static struct usb_serial_driver symbol_device = {
307 .unthrottle = symbol_unthrottle, 305 .unthrottle = symbol_unthrottle,
308}; 306};
309 307
308static struct usb_serial_driver * const serial_drivers[] = {
309 &symbol_device, NULL
310};
311
310static int __init symbol_init(void) 312static int __init symbol_init(void)
311{ 313{
312 int retval; 314 return usb_serial_register_drivers(&symbol_driver, serial_drivers);
313
314 retval = usb_serial_register(&symbol_device);
315 if (retval)
316 return retval;
317 retval = usb_register(&symbol_driver);
318 if (retval)
319 usb_serial_deregister(&symbol_device);
320 return retval;
321} 315}
322 316
323static void __exit symbol_exit(void) 317static void __exit symbol_exit(void)
324{ 318{
325 usb_deregister(&symbol_driver); 319 usb_serial_deregister_drivers(&symbol_driver, serial_drivers);
326 usb_serial_deregister(&symbol_device);
327} 320}
328 321
329module_init(symbol_init); 322module_init(symbol_init);