diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-02-23 14:56:32 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-24 15:39:18 -0500 |
commit | 97b6b6d2339f67eb17d954930a908b762af66228 (patch) | |
tree | 955eb92c831f444e26a930b3cd301393bb7112a0 /drivers | |
parent | 08a4f6bc2e7046ce50849d7589b7d0763926d808 (diff) |
usb-serial: use new registration API in [d-h]* drivers
This patch (as1524) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:
digi_acceleport, empeg, ftdi_sio, funsoft, garmin_gps,
and hp4x.
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/digi_acceleport.c | 32 | ||||
-rw-r--r-- | drivers/usb/serial/empeg.c | 26 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 26 | ||||
-rw-r--r-- | drivers/usb/serial/funsoft.c | 19 | ||||
-rw-r--r-- | drivers/usb/serial/garmin_gps.c | 25 | ||||
-rw-r--r-- | drivers/usb/serial/hp4x.c | 26 |
6 files changed, 52 insertions, 102 deletions
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 2b1da0cc071a..f0e776bb1ffb 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -276,7 +276,6 @@ static struct usb_driver digi_driver = { | |||
276 | .probe = usb_serial_probe, | 276 | .probe = usb_serial_probe, |
277 | .disconnect = usb_serial_disconnect, | 277 | .disconnect = usb_serial_disconnect, |
278 | .id_table = id_table_combined, | 278 | .id_table = id_table_combined, |
279 | .no_dynamic_id = 1, | ||
280 | }; | 279 | }; |
281 | 280 | ||
282 | 281 | ||
@@ -288,7 +287,6 @@ static struct usb_serial_driver digi_acceleport_2_device = { | |||
288 | .name = "digi_2", | 287 | .name = "digi_2", |
289 | }, | 288 | }, |
290 | .description = "Digi 2 port USB adapter", | 289 | .description = "Digi 2 port USB adapter", |
291 | .usb_driver = &digi_driver, | ||
292 | .id_table = id_table_2, | 290 | .id_table = id_table_2, |
293 | .num_ports = 3, | 291 | .num_ports = 3, |
294 | .open = digi_open, | 292 | .open = digi_open, |
@@ -316,7 +314,6 @@ static struct usb_serial_driver digi_acceleport_4_device = { | |||
316 | .name = "digi_4", | 314 | .name = "digi_4", |
317 | }, | 315 | }, |
318 | .description = "Digi 4 port USB adapter", | 316 | .description = "Digi 4 port USB adapter", |
319 | .usb_driver = &digi_driver, | ||
320 | .id_table = id_table_4, | 317 | .id_table = id_table_4, |
321 | .num_ports = 4, | 318 | .num_ports = 4, |
322 | .open = digi_open, | 319 | .open = digi_open, |
@@ -337,6 +334,9 @@ static struct usb_serial_driver digi_acceleport_4_device = { | |||
337 | .release = digi_release, | 334 | .release = digi_release, |
338 | }; | 335 | }; |
339 | 336 | ||
337 | static struct usb_serial_driver * const serial_drivers[] = { | ||
338 | &digi_acceleport_2_device, &digi_acceleport_4_device, NULL | ||
339 | }; | ||
340 | 340 | ||
341 | /* Functions */ | 341 | /* Functions */ |
342 | 342 | ||
@@ -1583,31 +1583,17 @@ static int digi_read_oob_callback(struct urb *urb) | |||
1583 | static int __init digi_init(void) | 1583 | static int __init digi_init(void) |
1584 | { | 1584 | { |
1585 | int retval; | 1585 | int retval; |
1586 | retval = usb_serial_register(&digi_acceleport_2_device); | 1586 | |
1587 | if (retval) | 1587 | retval = usb_serial_register_drivers(&digi_driver, serial_drivers); |
1588 | goto failed_acceleport_2_device; | 1588 | if (retval == 0) |
1589 | retval = usb_serial_register(&digi_acceleport_4_device); | 1589 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
1590 | if (retval) | 1590 | DRIVER_DESC "\n"); |
1591 | goto failed_acceleport_4_device; | ||
1592 | retval = usb_register(&digi_driver); | ||
1593 | if (retval) | ||
1594 | goto failed_usb_register; | ||
1595 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | ||
1596 | DRIVER_DESC "\n"); | ||
1597 | return 0; | ||
1598 | failed_usb_register: | ||
1599 | usb_serial_deregister(&digi_acceleport_4_device); | ||
1600 | failed_acceleport_4_device: | ||
1601 | usb_serial_deregister(&digi_acceleport_2_device); | ||
1602 | failed_acceleport_2_device: | ||
1603 | return retval; | 1591 | return retval; |
1604 | } | 1592 | } |
1605 | 1593 | ||
1606 | static void __exit digi_exit (void) | 1594 | static void __exit digi_exit (void) |
1607 | { | 1595 | { |
1608 | usb_deregister(&digi_driver); | 1596 | usb_serial_deregister_drivers(&digi_driver, serial_drivers); |
1609 | usb_serial_deregister(&digi_acceleport_2_device); | ||
1610 | usb_serial_deregister(&digi_acceleport_4_device); | ||
1611 | } | 1597 | } |
1612 | 1598 | ||
1613 | 1599 | ||
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index aced6817bf95..51bcbd5d5e8e 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c | |||
@@ -56,7 +56,6 @@ static struct usb_driver empeg_driver = { | |||
56 | .probe = usb_serial_probe, | 56 | .probe = usb_serial_probe, |
57 | .disconnect = usb_serial_disconnect, | 57 | .disconnect = usb_serial_disconnect, |
58 | .id_table = id_table, | 58 | .id_table = id_table, |
59 | .no_dynamic_id = 1, | ||
60 | }; | 59 | }; |
61 | 60 | ||
62 | static struct usb_serial_driver empeg_device = { | 61 | static struct usb_serial_driver empeg_device = { |
@@ -65,7 +64,6 @@ static struct usb_serial_driver empeg_device = { | |||
65 | .name = "empeg", | 64 | .name = "empeg", |
66 | }, | 65 | }, |
67 | .id_table = id_table, | 66 | .id_table = id_table, |
68 | .usb_driver = &empeg_driver, | ||
69 | .num_ports = 1, | 67 | .num_ports = 1, |
70 | .bulk_out_size = 256, | 68 | .bulk_out_size = 256, |
71 | .throttle = usb_serial_generic_throttle, | 69 | .throttle = usb_serial_generic_throttle, |
@@ -74,6 +72,10 @@ static struct usb_serial_driver empeg_device = { | |||
74 | .init_termios = empeg_init_termios, | 72 | .init_termios = empeg_init_termios, |
75 | }; | 73 | }; |
76 | 74 | ||
75 | static struct usb_serial_driver * const serial_drivers[] = { | ||
76 | &empeg_device, NULL | ||
77 | }; | ||
78 | |||
77 | static int empeg_startup(struct usb_serial *serial) | 79 | static int empeg_startup(struct usb_serial *serial) |
78 | { | 80 | { |
79 | int r; | 81 | int r; |
@@ -140,24 +142,16 @@ static int __init empeg_init(void) | |||
140 | { | 142 | { |
141 | int retval; | 143 | int retval; |
142 | 144 | ||
143 | retval = usb_serial_register(&empeg_device); | 145 | retval = usb_serial_register_drivers(&empeg_driver, serial_drivers); |
144 | if (retval) | 146 | if (retval == 0) |
145 | return retval; | 147 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
146 | retval = usb_register(&empeg_driver); | 148 | DRIVER_DESC "\n"); |
147 | if (retval) { | 149 | return retval; |
148 | usb_serial_deregister(&empeg_device); | ||
149 | return retval; | ||
150 | } | ||
151 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | ||
152 | DRIVER_DESC "\n"); | ||
153 | |||
154 | return 0; | ||
155 | } | 150 | } |
156 | 151 | ||
157 | static void __exit empeg_exit(void) | 152 | static void __exit empeg_exit(void) |
158 | { | 153 | { |
159 | usb_deregister(&empeg_driver); | 154 | usb_serial_deregister_drivers(&empeg_driver, serial_drivers); |
160 | usb_serial_deregister(&empeg_device); | ||
161 | } | 155 | } |
162 | 156 | ||
163 | 157 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index f770415305f8..615cf2c4915c 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -857,7 +857,6 @@ static struct usb_driver ftdi_driver = { | |||
857 | .probe = usb_serial_probe, | 857 | .probe = usb_serial_probe, |
858 | .disconnect = usb_serial_disconnect, | 858 | .disconnect = usb_serial_disconnect, |
859 | .id_table = id_table_combined, | 859 | .id_table = id_table_combined, |
860 | .no_dynamic_id = 1, | ||
861 | }; | 860 | }; |
862 | 861 | ||
863 | static const char *ftdi_chip_name[] = { | 862 | static const char *ftdi_chip_name[] = { |
@@ -915,7 +914,6 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
915 | .name = "ftdi_sio", | 914 | .name = "ftdi_sio", |
916 | }, | 915 | }, |
917 | .description = "FTDI USB Serial Device", | 916 | .description = "FTDI USB Serial Device", |
918 | .usb_driver = &ftdi_driver, | ||
919 | .id_table = id_table_combined, | 917 | .id_table = id_table_combined, |
920 | .num_ports = 1, | 918 | .num_ports = 1, |
921 | .bulk_in_size = 512, | 919 | .bulk_in_size = 512, |
@@ -938,6 +936,10 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
938 | .break_ctl = ftdi_break_ctl, | 936 | .break_ctl = ftdi_break_ctl, |
939 | }; | 937 | }; |
940 | 938 | ||
939 | static struct usb_serial_driver * const serial_drivers[] = { | ||
940 | &ftdi_sio_device, NULL | ||
941 | }; | ||
942 | |||
941 | 943 | ||
942 | #define WDR_TIMEOUT 5000 /* default urb timeout */ | 944 | #define WDR_TIMEOUT 5000 /* default urb timeout */ |
943 | #define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */ | 945 | #define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */ |
@@ -2420,19 +2422,10 @@ static int __init ftdi_init(void) | |||
2420 | id_table_combined[i].idVendor = vendor; | 2422 | id_table_combined[i].idVendor = vendor; |
2421 | id_table_combined[i].idProduct = product; | 2423 | id_table_combined[i].idProduct = product; |
2422 | } | 2424 | } |
2423 | retval = usb_serial_register(&ftdi_sio_device); | 2425 | retval = usb_serial_register_drivers(&ftdi_driver, serial_drivers); |
2424 | if (retval) | 2426 | if (retval == 0) |
2425 | goto failed_sio_register; | 2427 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
2426 | retval = usb_register(&ftdi_driver); | 2428 | DRIVER_DESC "\n"); |
2427 | if (retval) | ||
2428 | goto failed_usb_register; | ||
2429 | |||
2430 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | ||
2431 | DRIVER_DESC "\n"); | ||
2432 | return 0; | ||
2433 | failed_usb_register: | ||
2434 | usb_serial_deregister(&ftdi_sio_device); | ||
2435 | failed_sio_register: | ||
2436 | return retval; | 2429 | return retval; |
2437 | } | 2430 | } |
2438 | 2431 | ||
@@ -2440,8 +2433,7 @@ static void __exit ftdi_exit(void) | |||
2440 | { | 2433 | { |
2441 | dbg("%s", __func__); | 2434 | dbg("%s", __func__); |
2442 | 2435 | ||
2443 | usb_deregister(&ftdi_driver); | 2436 | usb_serial_deregister_drivers(&ftdi_driver, serial_drivers); |
2444 | usb_serial_deregister(&ftdi_sio_device); | ||
2445 | } | 2437 | } |
2446 | 2438 | ||
2447 | 2439 | ||
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c index 5d4b099dcf8b..bb274a244ae9 100644 --- a/drivers/usb/serial/funsoft.c +++ b/drivers/usb/serial/funsoft.c | |||
@@ -29,7 +29,6 @@ static struct usb_driver funsoft_driver = { | |||
29 | .probe = usb_serial_probe, | 29 | .probe = usb_serial_probe, |
30 | .disconnect = usb_serial_disconnect, | 30 | .disconnect = usb_serial_disconnect, |
31 | .id_table = id_table, | 31 | .id_table = id_table, |
32 | .no_dynamic_id = 1, | ||
33 | }; | 32 | }; |
34 | 33 | ||
35 | static struct usb_serial_driver funsoft_device = { | 34 | static struct usb_serial_driver funsoft_device = { |
@@ -38,27 +37,21 @@ static struct usb_serial_driver funsoft_device = { | |||
38 | .name = "funsoft", | 37 | .name = "funsoft", |
39 | }, | 38 | }, |
40 | .id_table = id_table, | 39 | .id_table = id_table, |
41 | .usb_driver = &funsoft_driver, | ||
42 | .num_ports = 1, | 40 | .num_ports = 1, |
43 | }; | 41 | }; |
44 | 42 | ||
43 | static struct usb_serial_driver * const serial_drivers[] = { | ||
44 | &funsoft_device, NULL | ||
45 | }; | ||
46 | |||
45 | static int __init funsoft_init(void) | 47 | static int __init funsoft_init(void) |
46 | { | 48 | { |
47 | int retval; | 49 | return usb_serial_register_drivers(&funsoft_driver, serial_drivers); |
48 | |||
49 | retval = usb_serial_register(&funsoft_device); | ||
50 | if (retval) | ||
51 | return retval; | ||
52 | retval = usb_register(&funsoft_driver); | ||
53 | if (retval) | ||
54 | usb_serial_deregister(&funsoft_device); | ||
55 | return retval; | ||
56 | } | 50 | } |
57 | 51 | ||
58 | static void __exit funsoft_exit(void) | 52 | static void __exit funsoft_exit(void) |
59 | { | 53 | { |
60 | usb_deregister(&funsoft_driver); | 54 | usb_serial_deregister_drivers(&funsoft_driver, serial_drivers); |
61 | usb_serial_deregister(&funsoft_device); | ||
62 | } | 55 | } |
63 | 56 | ||
64 | module_init(funsoft_init); | 57 | module_init(funsoft_init); |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 21343378c322..69da3abcb363 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -224,7 +224,6 @@ static struct usb_driver garmin_driver = { | |||
224 | .probe = usb_serial_probe, | 224 | .probe = usb_serial_probe, |
225 | .disconnect = usb_serial_disconnect, | 225 | .disconnect = usb_serial_disconnect, |
226 | .id_table = id_table, | 226 | .id_table = id_table, |
227 | .no_dynamic_id = 1, | ||
228 | }; | 227 | }; |
229 | 228 | ||
230 | 229 | ||
@@ -1497,7 +1496,6 @@ static struct usb_serial_driver garmin_device = { | |||
1497 | .name = "garmin_gps", | 1496 | .name = "garmin_gps", |
1498 | }, | 1497 | }, |
1499 | .description = "Garmin GPS usb/tty", | 1498 | .description = "Garmin GPS usb/tty", |
1500 | .usb_driver = &garmin_driver, | ||
1501 | .id_table = id_table, | 1499 | .id_table = id_table, |
1502 | .num_ports = 1, | 1500 | .num_ports = 1, |
1503 | .open = garmin_open, | 1501 | .open = garmin_open, |
@@ -1514,33 +1512,26 @@ static struct usb_serial_driver garmin_device = { | |||
1514 | .read_int_callback = garmin_read_int_callback, | 1512 | .read_int_callback = garmin_read_int_callback, |
1515 | }; | 1513 | }; |
1516 | 1514 | ||
1515 | static struct usb_serial_driver * const serial_drivers[] = { | ||
1516 | &garmin_device, NULL | ||
1517 | }; | ||
1517 | 1518 | ||
1518 | 1519 | ||
1519 | static int __init garmin_init(void) | 1520 | static int __init garmin_init(void) |
1520 | { | 1521 | { |
1521 | int retval; | 1522 | int retval; |
1522 | 1523 | ||
1523 | retval = usb_serial_register(&garmin_device); | 1524 | retval = usb_serial_register_drivers(&garmin_driver, serial_drivers); |
1524 | if (retval) | 1525 | if (retval == 0) |
1525 | goto failed_garmin_register; | 1526 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
1526 | retval = usb_register(&garmin_driver); | 1527 | DRIVER_DESC "\n"); |
1527 | if (retval) | ||
1528 | goto failed_usb_register; | ||
1529 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | ||
1530 | DRIVER_DESC "\n"); | ||
1531 | |||
1532 | return 0; | ||
1533 | failed_usb_register: | ||
1534 | usb_serial_deregister(&garmin_device); | ||
1535 | failed_garmin_register: | ||
1536 | return retval; | 1528 | return retval; |
1537 | } | 1529 | } |
1538 | 1530 | ||
1539 | 1531 | ||
1540 | static void __exit garmin_exit(void) | 1532 | static void __exit garmin_exit(void) |
1541 | { | 1533 | { |
1542 | usb_deregister(&garmin_driver); | 1534 | usb_serial_deregister_drivers(&garmin_driver, serial_drivers); |
1543 | usb_serial_deregister(&garmin_device); | ||
1544 | } | 1535 | } |
1545 | 1536 | ||
1546 | 1537 | ||
diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c index 809379159b0e..325cf092b61c 100644 --- a/drivers/usb/serial/hp4x.c +++ b/drivers/usb/serial/hp4x.c | |||
@@ -41,7 +41,6 @@ static struct usb_driver hp49gp_driver = { | |||
41 | .probe = usb_serial_probe, | 41 | .probe = usb_serial_probe, |
42 | .disconnect = usb_serial_disconnect, | 42 | .disconnect = usb_serial_disconnect, |
43 | .id_table = id_table, | 43 | .id_table = id_table, |
44 | .no_dynamic_id = 1, | ||
45 | }; | 44 | }; |
46 | 45 | ||
47 | static struct usb_serial_driver hp49gp_device = { | 46 | static struct usb_serial_driver hp49gp_device = { |
@@ -50,32 +49,27 @@ static struct usb_serial_driver hp49gp_device = { | |||
50 | .name = "hp4X", | 49 | .name = "hp4X", |
51 | }, | 50 | }, |
52 | .id_table = id_table, | 51 | .id_table = id_table, |
53 | .usb_driver = &hp49gp_driver, | ||
54 | .num_ports = 1, | 52 | .num_ports = 1, |
55 | }; | 53 | }; |
56 | 54 | ||
55 | static struct usb_serial_driver * const serial_drivers[] = { | ||
56 | &hp49gp_device, NULL | ||
57 | }; | ||
58 | |||
57 | static int __init hp49gp_init(void) | 59 | static int __init hp49gp_init(void) |
58 | { | 60 | { |
59 | int retval; | 61 | int retval; |
60 | retval = usb_serial_register(&hp49gp_device); | 62 | |
61 | if (retval) | 63 | retval = usb_serial_register_drivers(&hp49gp_driver, serial_drivers); |
62 | goto failed_usb_serial_register; | 64 | if (retval == 0) |
63 | retval = usb_register(&hp49gp_driver); | 65 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
64 | if (retval) | 66 | DRIVER_DESC "\n"); |
65 | goto failed_usb_register; | ||
66 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | ||
67 | DRIVER_DESC "\n"); | ||
68 | return 0; | ||
69 | failed_usb_register: | ||
70 | usb_serial_deregister(&hp49gp_device); | ||
71 | failed_usb_serial_register: | ||
72 | return retval; | 67 | return retval; |
73 | } | 68 | } |
74 | 69 | ||
75 | static void __exit hp49gp_exit(void) | 70 | static void __exit hp49gp_exit(void) |
76 | { | 71 | { |
77 | usb_deregister(&hp49gp_driver); | 72 | usb_serial_deregister_drivers(&hp49gp_driver, serial_drivers); |
78 | usb_serial_deregister(&hp49gp_device); | ||
79 | } | 73 | } |
80 | 74 | ||
81 | module_init(hp49gp_init); | 75 | module_init(hp49gp_init); |