aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-02-23 14:57:32 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-24 15:39:21 -0500
commit29618e9fb5507b9fcf07f739a8506a3640495945 (patch)
treed5b05698811d39a6068bd8bfae99e04cb6da4e8f /drivers
parentd860322f34e4a53f347b1aeae23d5b72f1e91b8c (diff)
usb-serial: use new registration API in [t-z]* drivers
This patch (as1529) modifies the following usb-serial drivers to utilize the new usb_serial_{de}register_drivers() routines: ti_usb_3410_5052, usb_debug, visor, vivopay-serial, whiteheat, and zio. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c35
-rw-r--r--drivers/usb/serial/usb_debug.c19
-rw-r--r--drivers/usb/serial/visor.c37
-rw-r--r--drivers/usb/serial/vivopay-serial.c27
-rw-r--r--drivers/usb/serial/whiteheat.c32
-rw-r--r--drivers/usb/serial/zio.c19
6 files changed, 48 insertions, 121 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 74f2c7746cc4..ab74123d658e 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -216,7 +216,6 @@ static struct usb_driver ti_usb_driver = {
216 .probe = usb_serial_probe, 216 .probe = usb_serial_probe,
217 .disconnect = usb_serial_disconnect, 217 .disconnect = usb_serial_disconnect,
218 .id_table = ti_id_table_combined, 218 .id_table = ti_id_table_combined,
219 .no_dynamic_id = 1,
220}; 219};
221 220
222static struct usb_serial_driver ti_1port_device = { 221static struct usb_serial_driver ti_1port_device = {
@@ -225,7 +224,6 @@ static struct usb_serial_driver ti_1port_device = {
225 .name = "ti_usb_3410_5052_1", 224 .name = "ti_usb_3410_5052_1",
226 }, 225 },
227 .description = "TI USB 3410 1 port adapter", 226 .description = "TI USB 3410 1 port adapter",
228 .usb_driver = &ti_usb_driver,
229 .id_table = ti_id_table_3410, 227 .id_table = ti_id_table_3410,
230 .num_ports = 1, 228 .num_ports = 1,
231 .attach = ti_startup, 229 .attach = ti_startup,
@@ -254,7 +252,6 @@ static struct usb_serial_driver ti_2port_device = {
254 .name = "ti_usb_3410_5052_2", 252 .name = "ti_usb_3410_5052_2",
255 }, 253 },
256 .description = "TI USB 5052 2 port adapter", 254 .description = "TI USB 5052 2 port adapter",
257 .usb_driver = &ti_usb_driver,
258 .id_table = ti_id_table_5052, 255 .id_table = ti_id_table_5052,
259 .num_ports = 2, 256 .num_ports = 2,
260 .attach = ti_startup, 257 .attach = ti_startup,
@@ -277,6 +274,9 @@ static struct usb_serial_driver ti_2port_device = {
277 .write_bulk_callback = ti_bulk_out_callback, 274 .write_bulk_callback = ti_bulk_out_callback,
278}; 275};
279 276
277static struct usb_serial_driver * const serial_drivers[] = {
278 &ti_1port_device, &ti_2port_device, NULL
279};
280 280
281/* Module */ 281/* Module */
282 282
@@ -344,36 +344,17 @@ static int __init ti_init(void)
344 ti_id_table_combined[c].match_flags = USB_DEVICE_ID_MATCH_DEVICE; 344 ti_id_table_combined[c].match_flags = USB_DEVICE_ID_MATCH_DEVICE;
345 } 345 }
346 346
347 ret = usb_serial_register(&ti_1port_device); 347 ret = usb_serial_register_drivers(&ti_usb_driver, serial_drivers);
348 if (ret) 348 if (ret == 0)
349 goto failed_1port; 349 printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
350 ret = usb_serial_register(&ti_2port_device); 350 TI_DRIVER_DESC "\n");
351 if (ret)
352 goto failed_2port;
353
354 ret = usb_register(&ti_usb_driver);
355 if (ret)
356 goto failed_usb;
357
358 printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
359 TI_DRIVER_DESC "\n");
360
361 return 0;
362
363failed_usb:
364 usb_serial_deregister(&ti_2port_device);
365failed_2port:
366 usb_serial_deregister(&ti_1port_device);
367failed_1port:
368 return ret; 351 return ret;
369} 352}
370 353
371 354
372static void __exit ti_exit(void) 355static void __exit ti_exit(void)
373{ 356{
374 usb_deregister(&ti_usb_driver); 357 usb_serial_deregister_drivers(&ti_usb_driver, serial_drivers);
375 usb_serial_deregister(&ti_1port_device);
376 usb_serial_deregister(&ti_2port_device);
377} 358}
378 359
379 360
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c
index 9b632e753210..5b29b4a2ebc7 100644
--- a/drivers/usb/serial/usb_debug.c
+++ b/drivers/usb/serial/usb_debug.c
@@ -40,7 +40,6 @@ static struct usb_driver debug_driver = {
40 .probe = usb_serial_probe, 40 .probe = usb_serial_probe,
41 .disconnect = usb_serial_disconnect, 41 .disconnect = usb_serial_disconnect,
42 .id_table = id_table, 42 .id_table = id_table,
43 .no_dynamic_id = 1,
44}; 43};
45 44
46/* This HW really does not support a serial break, so one will be 45/* This HW really does not support a serial break, so one will be
@@ -74,30 +73,24 @@ static struct usb_serial_driver debug_device = {
74 .name = "debug", 73 .name = "debug",
75 }, 74 },
76 .id_table = id_table, 75 .id_table = id_table,
77 .usb_driver = &debug_driver,
78 .num_ports = 1, 76 .num_ports = 1,
79 .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE, 77 .bulk_out_size = USB_DEBUG_MAX_PACKET_SIZE,
80 .break_ctl = usb_debug_break_ctl, 78 .break_ctl = usb_debug_break_ctl,
81 .process_read_urb = usb_debug_process_read_urb, 79 .process_read_urb = usb_debug_process_read_urb,
82}; 80};
83 81
82static struct usb_serial_driver * const serial_drivers[] = {
83 &debug_device, NULL
84};
85
84static int __init debug_init(void) 86static int __init debug_init(void)
85{ 87{
86 int retval; 88 return usb_serial_register_drivers(&debug_driver, serial_drivers);
87
88 retval = usb_serial_register(&debug_device);
89 if (retval)
90 return retval;
91 retval = usb_register(&debug_driver);
92 if (retval)
93 usb_serial_deregister(&debug_device);
94 return retval;
95} 89}
96 90
97static void __exit debug_exit(void) 91static void __exit debug_exit(void)
98{ 92{
99 usb_deregister(&debug_driver); 93 usb_serial_deregister_drivers(&debug_driver, serial_drivers);
100 usb_serial_deregister(&debug_device);
101} 94}
102 95
103module_init(debug_init); 96module_init(debug_init);
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 210e4b10dc11..71d696474f24 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -173,7 +173,6 @@ static struct usb_driver visor_driver = {
173 .probe = usb_serial_probe, 173 .probe = usb_serial_probe,
174 .disconnect = usb_serial_disconnect, 174 .disconnect = usb_serial_disconnect,
175 .id_table = id_table_combined, 175 .id_table = id_table_combined,
176 .no_dynamic_id = 1,
177}; 176};
178 177
179/* All of the device info needed for the Handspring Visor, 178/* All of the device info needed for the Handspring Visor,
@@ -184,7 +183,6 @@ static struct usb_serial_driver handspring_device = {
184 .name = "visor", 183 .name = "visor",
185 }, 184 },
186 .description = "Handspring Visor / Palm OS", 185 .description = "Handspring Visor / Palm OS",
187 .usb_driver = &visor_driver,
188 .id_table = id_table, 186 .id_table = id_table,
189 .num_ports = 2, 187 .num_ports = 2,
190 .bulk_out_size = 256, 188 .bulk_out_size = 256,
@@ -205,7 +203,6 @@ static struct usb_serial_driver clie_5_device = {
205 .name = "clie_5", 203 .name = "clie_5",
206 }, 204 },
207 .description = "Sony Clie 5.0", 205 .description = "Sony Clie 5.0",
208 .usb_driver = &visor_driver,
209 .id_table = clie_id_5_table, 206 .id_table = clie_id_5_table,
210 .num_ports = 2, 207 .num_ports = 2,
211 .bulk_out_size = 256, 208 .bulk_out_size = 256,
@@ -226,7 +223,6 @@ static struct usb_serial_driver clie_3_5_device = {
226 .name = "clie_3.5", 223 .name = "clie_3.5",
227 }, 224 },
228 .description = "Sony Clie 3.5", 225 .description = "Sony Clie 3.5",
229 .usb_driver = &visor_driver,
230 .id_table = clie_id_3_5_table, 226 .id_table = clie_id_3_5_table,
231 .num_ports = 1, 227 .num_ports = 1,
232 .bulk_out_size = 256, 228 .bulk_out_size = 256,
@@ -237,6 +233,10 @@ static struct usb_serial_driver clie_3_5_device = {
237 .attach = clie_3_5_startup, 233 .attach = clie_3_5_startup,
238}; 234};
239 235
236static struct usb_serial_driver * const serial_drivers[] = {
237 &handspring_device, &clie_5_device, &clie_3_5_device, NULL
238};
239
240/****************************************************************************** 240/******************************************************************************
241 * Handspring Visor specific driver functions 241 * Handspring Visor specific driver functions
242 ******************************************************************************/ 242 ******************************************************************************/
@@ -685,38 +685,17 @@ static int __init visor_init(void)
685 ": Adding Palm OS protocol 4.x support for unknown device: 0x%x/0x%x\n", 685 ": Adding Palm OS protocol 4.x support for unknown device: 0x%x/0x%x\n",
686 vendor, product); 686 vendor, product);
687 } 687 }
688 retval = usb_serial_register(&handspring_device);
689 if (retval)
690 goto failed_handspring_register;
691 retval = usb_serial_register(&clie_3_5_device);
692 if (retval)
693 goto failed_clie_3_5_register;
694 retval = usb_serial_register(&clie_5_device);
695 if (retval)
696 goto failed_clie_5_register;
697 retval = usb_register(&visor_driver);
698 if (retval)
699 goto failed_usb_register;
700 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
701 688
702 return 0; 689 retval = usb_serial_register_drivers(&visor_driver, serial_drivers);
703failed_usb_register: 690 if (retval == 0)
704 usb_serial_deregister(&clie_5_device); 691 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
705failed_clie_5_register:
706 usb_serial_deregister(&clie_3_5_device);
707failed_clie_3_5_register:
708 usb_serial_deregister(&handspring_device);
709failed_handspring_register:
710 return retval; 692 return retval;
711} 693}
712 694
713 695
714static void __exit visor_exit (void) 696static void __exit visor_exit (void)
715{ 697{
716 usb_deregister(&visor_driver); 698 usb_serial_deregister_drivers(&visor_driver, serial_drivers);
717 usb_serial_deregister(&handspring_device);
718 usb_serial_deregister(&clie_3_5_device);
719 usb_serial_deregister(&clie_5_device);
720} 699}
721 700
722 701
diff --git a/drivers/usb/serial/vivopay-serial.c b/drivers/usb/serial/vivopay-serial.c
index f719d00972fc..a6f113bd4fae 100644
--- a/drivers/usb/serial/vivopay-serial.c
+++ b/drivers/usb/serial/vivopay-serial.c
@@ -30,7 +30,6 @@ static struct usb_driver vivopay_serial_driver = {
30 .probe = usb_serial_probe, 30 .probe = usb_serial_probe,
31 .disconnect = usb_serial_disconnect, 31 .disconnect = usb_serial_disconnect,
32 .id_table = id_table, 32 .id_table = id_table,
33 .no_dynamic_id = 1,
34}; 33};
35 34
36static struct usb_serial_driver vivopay_serial_device = { 35static struct usb_serial_driver vivopay_serial_device = {
@@ -39,32 +38,28 @@ static struct usb_serial_driver vivopay_serial_device = {
39 .name = "vivopay-serial", 38 .name = "vivopay-serial",
40 }, 39 },
41 .id_table = id_table, 40 .id_table = id_table,
42 .usb_driver = &vivopay_serial_driver,
43 .num_ports = 1, 41 .num_ports = 1,
44}; 42};
45 43
44static struct usb_serial_driver * const serial_drivers[] = {
45 &vivopay_serial_device, NULL
46};
47
46static int __init vivopay_serial_init(void) 48static int __init vivopay_serial_init(void)
47{ 49{
48 int retval; 50 int retval;
49 retval = usb_serial_register(&vivopay_serial_device); 51
50 if (retval) 52 retval = usb_serial_register_drivers(&vivopay_serial_driver,
51 goto failed_usb_serial_register; 53 serial_drivers);
52 retval = usb_register(&vivopay_serial_driver); 54 if (retval == 0)
53 if (retval) 55 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
54 goto failed_usb_register; 56 DRIVER_DESC "\n");
55 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
56 DRIVER_DESC "\n");
57 return 0;
58failed_usb_register:
59 usb_serial_deregister(&vivopay_serial_device);
60failed_usb_serial_register:
61 return retval; 57 return retval;
62} 58}
63 59
64static void __exit vivopay_serial_exit(void) 60static void __exit vivopay_serial_exit(void)
65{ 61{
66 usb_deregister(&vivopay_serial_driver); 62 usb_serial_deregister_drivers(&vivopay_serial_driver, serial_drivers);
67 usb_serial_deregister(&vivopay_serial_device);
68} 63}
69 64
70module_init(vivopay_serial_init); 65module_init(vivopay_serial_init);
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 007cf3a2481a..a29be37a3a67 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -83,7 +83,6 @@ static struct usb_driver whiteheat_driver = {
83 .probe = usb_serial_probe, 83 .probe = usb_serial_probe,
84 .disconnect = usb_serial_disconnect, 84 .disconnect = usb_serial_disconnect,
85 .id_table = id_table_combined, 85 .id_table = id_table_combined,
86 .no_dynamic_id = 1,
87}; 86};
88 87
89/* function prototypes for the Connect Tech WhiteHEAT prerenumeration device */ 88/* function prototypes for the Connect Tech WhiteHEAT prerenumeration device */
@@ -121,7 +120,6 @@ static struct usb_serial_driver whiteheat_fake_device = {
121 .name = "whiteheatnofirm", 120 .name = "whiteheatnofirm",
122 }, 121 },
123 .description = "Connect Tech - WhiteHEAT - (prerenumeration)", 122 .description = "Connect Tech - WhiteHEAT - (prerenumeration)",
124 .usb_driver = &whiteheat_driver,
125 .id_table = id_table_prerenumeration, 123 .id_table = id_table_prerenumeration,
126 .num_ports = 1, 124 .num_ports = 1,
127 .probe = whiteheat_firmware_download, 125 .probe = whiteheat_firmware_download,
@@ -134,7 +132,6 @@ static struct usb_serial_driver whiteheat_device = {
134 .name = "whiteheat", 132 .name = "whiteheat",
135 }, 133 },
136 .description = "Connect Tech - WhiteHEAT", 134 .description = "Connect Tech - WhiteHEAT",
137 .usb_driver = &whiteheat_driver,
138 .id_table = id_table_std, 135 .id_table = id_table_std,
139 .num_ports = 4, 136 .num_ports = 4,
140 .attach = whiteheat_attach, 137 .attach = whiteheat_attach,
@@ -155,6 +152,9 @@ static struct usb_serial_driver whiteheat_device = {
155 .write_bulk_callback = whiteheat_write_callback, 152 .write_bulk_callback = whiteheat_write_callback,
156}; 153};
157 154
155static struct usb_serial_driver * const serial_drivers[] = {
156 &whiteheat_fake_device, &whiteheat_device, NULL
157};
158 158
159struct whiteheat_command_private { 159struct whiteheat_command_private {
160 struct mutex mutex; 160 struct mutex mutex;
@@ -1461,32 +1461,18 @@ out:
1461static int __init whiteheat_init(void) 1461static int __init whiteheat_init(void)
1462{ 1462{
1463 int retval; 1463 int retval;
1464 retval = usb_serial_register(&whiteheat_fake_device); 1464
1465 if (retval) 1465 retval = usb_serial_register_drivers(&whiteheat_driver, serial_drivers);
1466 goto failed_fake_register; 1466 if (retval == 0)
1467 retval = usb_serial_register(&whiteheat_device); 1467 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1468 if (retval) 1468 DRIVER_DESC "\n");
1469 goto failed_device_register;
1470 retval = usb_register(&whiteheat_driver);
1471 if (retval)
1472 goto failed_usb_register;
1473 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1474 DRIVER_DESC "\n");
1475 return 0;
1476failed_usb_register:
1477 usb_serial_deregister(&whiteheat_device);
1478failed_device_register:
1479 usb_serial_deregister(&whiteheat_fake_device);
1480failed_fake_register:
1481 return retval; 1469 return retval;
1482} 1470}
1483 1471
1484 1472
1485static void __exit whiteheat_exit(void) 1473static void __exit whiteheat_exit(void)
1486{ 1474{
1487 usb_deregister(&whiteheat_driver); 1475 usb_serial_deregister_drivers(&whiteheat_driver, serial_drivers);
1488 usb_serial_deregister(&whiteheat_fake_device);
1489 usb_serial_deregister(&whiteheat_device);
1490} 1476}
1491 1477
1492 1478
diff --git a/drivers/usb/serial/zio.c b/drivers/usb/serial/zio.c
index f57967278833..ae8115aab77d 100644
--- a/drivers/usb/serial/zio.c
+++ b/drivers/usb/serial/zio.c
@@ -27,7 +27,6 @@ static struct usb_driver zio_driver = {
27 .probe = usb_serial_probe, 27 .probe = usb_serial_probe,
28 .disconnect = usb_serial_disconnect, 28 .disconnect = usb_serial_disconnect,
29 .id_table = id_table, 29 .id_table = id_table,
30 .no_dynamic_id = 1,
31}; 30};
32 31
33static struct usb_serial_driver zio_device = { 32static struct usb_serial_driver zio_device = {
@@ -36,27 +35,21 @@ static struct usb_serial_driver zio_device = {
36 .name = "zio", 35 .name = "zio",
37 }, 36 },
38 .id_table = id_table, 37 .id_table = id_table,
39 .usb_driver = &zio_driver,
40 .num_ports = 1, 38 .num_ports = 1,
41}; 39};
42 40
41static struct usb_serial_driver * const serial_drivers[] = {
42 &zio_device, NULL
43};
44
43static int __init zio_init(void) 45static int __init zio_init(void)
44{ 46{
45 int retval; 47 return usb_serial_register_drivers(&zio_driver, serial_drivers);
46
47 retval = usb_serial_register(&zio_device);
48 if (retval)
49 return retval;
50 retval = usb_register(&zio_driver);
51 if (retval)
52 usb_serial_deregister(&zio_device);
53 return retval;
54} 48}
55 49
56static void __exit zio_exit(void) 50static void __exit zio_exit(void)
57{ 51{
58 usb_deregister(&zio_driver); 52 usb_serial_deregister_drivers(&zio_driver, serial_drivers);
59 usb_serial_deregister(&zio_device);
60} 53}
61 54
62module_init(zio_init); 55module_init(zio_init);