aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/Kconfig9
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/aircable.c30
-rw-r--r--drivers/usb/serial/ark3116.c30
-rw-r--r--drivers/usb/serial/belkin_sa.c35
-rw-r--r--drivers/usb/serial/ch341.c27
-rw-r--r--drivers/usb/serial/cp210x.c156
-rw-r--r--drivers/usb/serial/cyberjack.c36
-rw-r--r--drivers/usb/serial/cypress_m8.c64
-rw-r--r--drivers/usb/serial/digi_acceleport.c45
-rw-r--r--drivers/usb/serial/empeg.c34
-rw-r--r--drivers/usb/serial/f81232.c405
-rw-r--r--drivers/usb/serial/ftdi_sio.c48
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h30
-rw-r--r--drivers/usb/serial/funsoft.c25
-rw-r--r--drivers/usb/serial/garmin_gps.c40
-rw-r--r--drivers/usb/serial/generic.c19
-rw-r--r--drivers/usb/serial/hp4x.c31
-rw-r--r--drivers/usb/serial/io_edgeport.c66
-rw-r--r--drivers/usb/serial/io_tables.h10
-rw-r--r--drivers/usb/serial/io_ti.c54
-rw-r--r--drivers/usb/serial/ipaq.c28
-rw-r--r--drivers/usb/serial/ipw.c32
-rw-r--r--drivers/usb/serial/ir-usb.c30
-rw-r--r--drivers/usb/serial/iuu_phoenix.c31
-rw-r--r--drivers/usb/serial/keyspan.c48
-rw-r--r--drivers/usb/serial/keyspan.h10
-rw-r--r--drivers/usb/serial/keyspan_pda.c62
-rw-r--r--drivers/usb/serial/kl5kusb105.c37
-rw-r--r--drivers/usb/serial/kobil_sct.c37
-rw-r--r--drivers/usb/serial/mct_u232.c34
-rw-r--r--drivers/usb/serial/mos7720.c46
-rw-r--r--drivers/usb/serial/mos7840.c59
-rw-r--r--drivers/usb/serial/moto_modem.c26
-rw-r--r--drivers/usb/serial/navman.c25
-rw-r--r--drivers/usb/serial/omninet.c38
-rw-r--r--drivers/usb/serial/opticon.c25
-rw-r--r--drivers/usb/serial/option.c89
-rw-r--r--drivers/usb/serial/oti6858.c36
-rw-r--r--drivers/usb/serial/pl2303.c31
-rw-r--r--drivers/usb/serial/qcaux.c33
-rw-r--r--drivers/usb/serial/qcserial.c140
-rw-r--r--drivers/usb/serial/safe_serial.c24
-rw-r--r--drivers/usb/serial/siemens_mpi.c30
-rw-r--r--drivers/usb/serial/sierra.c37
-rw-r--r--drivers/usb/serial/spcp8x5.c31
-rw-r--r--drivers/usb/serial/ssu100.c40
-rw-r--r--drivers/usb/serial/symbolserial.c25
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c46
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.h4
-rw-r--r--drivers/usb/serial/usb-serial.c77
-rw-r--r--drivers/usb/serial/usb_debug.c26
-rw-r--r--drivers/usb/serial/visor.c37
-rw-r--r--drivers/usb/serial/vivopay-serial.c31
-rw-r--r--drivers/usb/serial/whiteheat.c47
-rw-r--r--drivers/usb/serial/zio.c26
56 files changed, 1003 insertions, 1570 deletions
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 677f577c0243..434df7f2a4bd 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -238,6 +238,15 @@ config USB_SERIAL_EDGEPORT_TI
238 To compile this driver as a module, choose M here: the 238 To compile this driver as a module, choose M here: the
239 module will be called io_ti. 239 module will be called io_ti.
240 240
241config USB_SERIAL_F81232
242 tristate "USB Fintek F81232 Single Port Serial Driver"
243 help
244 Say Y here if you want to use the Fintek F81232 single
245 port usb to serial adapter.
246
247 To compile this driver as a module, choose M here: the
248 module will be called f81232.
249
241config USB_SERIAL_GARMIN 250config USB_SERIAL_GARMIN
242 tristate "USB Garmin GPS driver" 251 tristate "USB Garmin GPS driver"
243 help 252 help
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 9e536eefb32c..5ac438b40270 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_USB_SERIAL_DIGI_ACCELEPORT) += digi_acceleport.o
23obj-$(CONFIG_USB_SERIAL_EDGEPORT) += io_edgeport.o 23obj-$(CONFIG_USB_SERIAL_EDGEPORT) += io_edgeport.o
24obj-$(CONFIG_USB_SERIAL_EDGEPORT_TI) += io_ti.o 24obj-$(CONFIG_USB_SERIAL_EDGEPORT_TI) += io_ti.o
25obj-$(CONFIG_USB_SERIAL_EMPEG) += empeg.o 25obj-$(CONFIG_USB_SERIAL_EMPEG) += empeg.o
26obj-$(CONFIG_USB_SERIAL_F81232) += f81232.o
26obj-$(CONFIG_USB_SERIAL_FTDI_SIO) += ftdi_sio.o 27obj-$(CONFIG_USB_SERIAL_FTDI_SIO) += ftdi_sio.o
27obj-$(CONFIG_USB_SERIAL_FUNSOFT) += funsoft.o 28obj-$(CONFIG_USB_SERIAL_FUNSOFT) += funsoft.o
28obj-$(CONFIG_USB_SERIAL_GARMIN) += garmin_gps.o 29obj-$(CONFIG_USB_SERIAL_GARMIN) += garmin_gps.o
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 123bf9155339..eec4fb9a35c1 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,36 +192,16 @@ static struct usb_serial_driver aircable_device = {
194 .unthrottle = usb_serial_generic_unthrottle, 192 .unthrottle = usb_serial_generic_unthrottle,
195}; 193};
196 194
197static int __init aircable_init(void) 195static struct usb_serial_driver * const serial_drivers[] = {
198{ 196 &aircable_device, NULL
199 int retval; 197};
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}
213 198
214static void __exit aircable_exit(void) 199module_usb_serial_driver(aircable_driver, serial_drivers);
215{
216 usb_deregister(&aircable_driver);
217 usb_serial_deregister(&aircable_device);
218}
219 200
220MODULE_AUTHOR(DRIVER_AUTHOR); 201MODULE_AUTHOR(DRIVER_AUTHOR);
221MODULE_DESCRIPTION(DRIVER_DESC); 202MODULE_DESCRIPTION(DRIVER_DESC);
222MODULE_VERSION(DRIVER_VERSION); 203MODULE_VERSION(DRIVER_VERSION);
223MODULE_LICENSE("GPL"); 204MODULE_LICENSE("GPL");
224 205
225module_init(aircable_init);
226module_exit(aircable_exit);
227
228module_param(debug, bool, S_IRUGO | S_IWUSR); 206module_param(debug, bool, S_IRUGO | S_IWUSR);
229MODULE_PARM_DESC(debug, "Debug enabled or not"); 207MODULE_PARM_DESC(debug, "Debug enabled or not");
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 69328dcfd91a..f99f47100dd8 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,32 +743,12 @@ 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
748static int __init ark3116_init(void) 746static struct usb_serial_driver * const serial_drivers[] = {
749{ 747 &ark3116_device, NULL
750 int retval; 748};
751
752 retval = usb_serial_register(&ark3116_device);
753 if (retval)
754 return retval;
755 retval = usb_register(&ark3116_driver);
756 if (retval == 0) {
757 printk(KERN_INFO "%s:"
758 DRIVER_VERSION ":"
759 DRIVER_DESC "\n",
760 KBUILD_MODNAME);
761 } else
762 usb_serial_deregister(&ark3116_device);
763 return retval;
764}
765 749
766static void __exit ark3116_exit(void) 750module_usb_serial_driver(ark3116_driver, serial_drivers);
767{
768 usb_deregister(&ark3116_driver);
769 usb_serial_deregister(&ark3116_device);
770}
771 751
772module_init(ark3116_init);
773module_exit(ark3116_exit);
774MODULE_LICENSE("GPL"); 752MODULE_LICENSE("GPL");
775 753
776MODULE_AUTHOR(DRIVER_AUTHOR); 754MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 29ffeb6279c7..a52e0d2cec31 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;
@@ -522,34 +524,7 @@ exit:
522 return retval; 524 return retval;
523} 525}
524 526
525 527module_usb_serial_driver(belkin_driver, serial_drivers);
526static int __init belkin_sa_init(void)
527{
528 int retval;
529 retval = usb_serial_register(&belkin_device);
530 if (retval)
531 goto failed_usb_serial_register;
532 retval = usb_register(&belkin_driver);
533 if (retval)
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;
542}
543
544static void __exit belkin_sa_exit (void)
545{
546 usb_deregister(&belkin_driver);
547 usb_serial_deregister(&belkin_device);
548}
549
550
551module_init(belkin_sa_init);
552module_exit(belkin_sa_exit);
553 528
554MODULE_AUTHOR(DRIVER_AUTHOR); 529MODULE_AUTHOR(DRIVER_AUTHOR);
555MODULE_DESCRIPTION(DRIVER_DESC); 530MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 5e53cc59e652..aaab32db31d0 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,30 +648,13 @@ static struct usb_serial_driver ch341_device = {
650 .attach = ch341_attach, 648 .attach = ch341_attach,
651}; 649};
652 650
653static int __init ch341_init(void) 651static struct usb_serial_driver * const serial_drivers[] = {
654{ 652 &ch341_device, NULL
655 int retval; 653};
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}
665 654
666static void __exit ch341_exit(void) 655module_usb_serial_driver(ch341_driver, serial_drivers);
667{
668 usb_deregister(&ch341_driver);
669 usb_serial_deregister(&ch341_device);
670}
671 656
672module_init(ch341_init);
673module_exit(ch341_exit);
674MODULE_LICENSE("GPL"); 657MODULE_LICENSE("GPL");
675 658
676module_param(debug, bool, S_IRUGO | S_IWUSR); 659module_param(debug, bool, S_IRUGO | S_IWUSR);
677MODULE_PARM_DESC(debug, "Debug enabled or not"); 660MODULE_PARM_DESC(debug, "Debug enabled or not");
678
679/* EOF ch341.c */
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index fba1147ed916..651b2aa13486 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -39,6 +39,8 @@ static void cp210x_get_termios(struct tty_struct *,
39 struct usb_serial_port *port); 39 struct usb_serial_port *port);
40static void cp210x_get_termios_port(struct usb_serial_port *port, 40static void cp210x_get_termios_port(struct usb_serial_port *port,
41 unsigned int *cflagp, unsigned int *baudp); 41 unsigned int *cflagp, unsigned int *baudp);
42static void cp210x_change_speed(struct tty_struct *, struct usb_serial_port *,
43 struct ktermios *);
42static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *, 44static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *,
43 struct ktermios*); 45 struct ktermios*);
44static int cp210x_tiocmget(struct tty_struct *); 46static int cp210x_tiocmget(struct tty_struct *);
@@ -134,10 +136,13 @@ static const struct usb_device_id id_table[] = {
134 { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ 136 { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */
135 { USB_DEVICE(0x16DC, 0x0012) }, /* W-IE-NE-R Plein & Baus GmbH MPOD Multi Channel Power Supply */ 137 { USB_DEVICE(0x16DC, 0x0012) }, /* W-IE-NE-R Plein & Baus GmbH MPOD Multi Channel Power Supply */
136 { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */ 138 { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */
139 { USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */
140 { USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */
137 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ 141 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
138 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ 142 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
139 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ 143 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
140 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ 144 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
145 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
141 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ 146 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
142 { } /* Terminating Entry */ 147 { } /* Terminating Entry */
143}; 148};
@@ -149,7 +154,6 @@ static struct usb_driver cp210x_driver = {
149 .probe = usb_serial_probe, 154 .probe = usb_serial_probe,
150 .disconnect = usb_serial_disconnect, 155 .disconnect = usb_serial_disconnect,
151 .id_table = id_table, 156 .id_table = id_table,
152 .no_dynamic_id = 1,
153}; 157};
154 158
155static struct usb_serial_driver cp210x_device = { 159static struct usb_serial_driver cp210x_device = {
@@ -157,7 +161,6 @@ static struct usb_serial_driver cp210x_device = {
157 .owner = THIS_MODULE, 161 .owner = THIS_MODULE,
158 .name = "cp210x", 162 .name = "cp210x",
159 }, 163 },
160 .usb_driver = &cp210x_driver,
161 .id_table = id_table, 164 .id_table = id_table,
162 .num_ports = 1, 165 .num_ports = 1,
163 .bulk_in_size = 256, 166 .bulk_in_size = 256,
@@ -172,6 +175,10 @@ static struct usb_serial_driver cp210x_device = {
172 .dtr_rts = cp210x_dtr_rts 175 .dtr_rts = cp210x_dtr_rts
173}; 176};
174 177
178static struct usb_serial_driver * const serial_drivers[] = {
179 &cp210x_device, NULL
180};
181
175/* Config request types */ 182/* Config request types */
176#define REQTYPE_HOST_TO_DEVICE 0x41 183#define REQTYPE_HOST_TO_DEVICE 0x41
177#define REQTYPE_DEVICE_TO_HOST 0xc1 184#define REQTYPE_DEVICE_TO_HOST 0xc1
@@ -201,6 +208,8 @@ static struct usb_serial_driver cp210x_device = {
201#define CP210X_EMBED_EVENTS 0x15 208#define CP210X_EMBED_EVENTS 0x15
202#define CP210X_GET_EVENTSTATE 0x16 209#define CP210X_GET_EVENTSTATE 0x16
203#define CP210X_SET_CHARS 0x19 210#define CP210X_SET_CHARS 0x19
211#define CP210X_GET_BAUDRATE 0x1D
212#define CP210X_SET_BAUDRATE 0x1E
204 213
205/* CP210X_IFC_ENABLE */ 214/* CP210X_IFC_ENABLE */
206#define UART_ENABLE 0x0001 215#define UART_ENABLE 0x0001
@@ -279,7 +288,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
279 288
280 if (result != size) { 289 if (result != size) {
281 dbg("%s - Unable to send config request, " 290 dbg("%s - Unable to send config request, "
282 "request=0x%x size=%d result=%d\n", 291 "request=0x%x size=%d result=%d",
283 __func__, request, size, result); 292 __func__, request, size, result);
284 if (result > 0) 293 if (result > 0)
285 result = -EPROTO; 294 result = -EPROTO;
@@ -333,7 +342,7 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
333 342
334 if ((size > 2 && result != size) || result < 0) { 343 if ((size > 2 && result != size) || result < 0) {
335 dbg("%s - Unable to send request, " 344 dbg("%s - Unable to send request, "
336 "request=0x%x size=%d result=%d\n", 345 "request=0x%x size=%d result=%d",
337 __func__, request, size, result); 346 __func__, request, size, result);
338 if (result > 0) 347 if (result > 0)
339 result = -EPROTO; 348 result = -EPROTO;
@@ -360,8 +369,8 @@ static inline int cp210x_set_config_single(struct usb_serial_port *port,
360 * Quantises the baud rate as per AN205 Table 1 369 * Quantises the baud rate as per AN205 Table 1
361 */ 370 */
362static unsigned int cp210x_quantise_baudrate(unsigned int baud) { 371static unsigned int cp210x_quantise_baudrate(unsigned int baud) {
363 if (baud <= 56) baud = 0; 372 if (baud <= 300)
364 else if (baud <= 300) baud = 300; 373 baud = 300;
365 else if (baud <= 600) baud = 600; 374 else if (baud <= 600) baud = 600;
366 else if (baud <= 1200) baud = 1200; 375 else if (baud <= 1200) baud = 1200;
367 else if (baud <= 1800) baud = 1800; 376 else if (baud <= 1800) baud = 1800;
@@ -389,10 +398,10 @@ static unsigned int cp210x_quantise_baudrate(unsigned int baud) {
389 else if (baud <= 491520) baud = 460800; 398 else if (baud <= 491520) baud = 460800;
390 else if (baud <= 567138) baud = 500000; 399 else if (baud <= 567138) baud = 500000;
391 else if (baud <= 670254) baud = 576000; 400 else if (baud <= 670254) baud = 576000;
392 else if (baud <= 1053257) baud = 921600; 401 else if (baud < 1000000)
393 else if (baud <= 1474560) baud = 1228800; 402 baud = 921600;
394 else if (baud <= 2457600) baud = 1843200; 403 else if (baud > 2000000)
395 else baud = 3686400; 404 baud = 2000000;
396 return baud; 405 return baud;
397} 406}
398 407
@@ -409,13 +418,14 @@ static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
409 return result; 418 return result;
410 } 419 }
411 420
412 result = usb_serial_generic_open(tty, port);
413 if (result)
414 return result;
415
416 /* Configure the termios structure */ 421 /* Configure the termios structure */
417 cp210x_get_termios(tty, port); 422 cp210x_get_termios(tty, port);
418 return 0; 423
424 /* The baud rate must be initialised on cp2104 */
425 if (tty)
426 cp210x_change_speed(tty, port, NULL);
427
428 return usb_serial_generic_open(tty, port);
419} 429}
420 430
421static void cp210x_close(struct usb_serial_port *port) 431static void cp210x_close(struct usb_serial_port *port)
@@ -467,10 +477,7 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
467 477
468 dbg("%s - port %d", __func__, port->number); 478 dbg("%s - port %d", __func__, port->number);
469 479
470 cp210x_get_config(port, CP210X_GET_BAUDDIV, &baud, 2); 480 cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4);
471 /* Convert to baudrate */
472 if (baud)
473 baud = cp210x_quantise_baudrate((BAUD_RATE_GEN_FREQ + baud/2)/ baud);
474 481
475 dbg("%s - baud rate = %d", __func__, baud); 482 dbg("%s - baud rate = %d", __func__, baud);
476 *baudp = baud; 483 *baudp = baud;
@@ -579,11 +586,64 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
579 *cflagp = cflag; 586 *cflagp = cflag;
580} 587}
581 588
589/*
590 * CP2101 supports the following baud rates:
591 *
592 * 300, 600, 1200, 1800, 2400, 4800, 7200, 9600, 14400, 19200, 28800,
593 * 38400, 56000, 57600, 115200, 128000, 230400, 460800, 921600
594 *
595 * CP2102 and CP2103 support the following additional rates:
596 *
597 * 4000, 16000, 51200, 64000, 76800, 153600, 250000, 256000, 500000,
598 * 576000
599 *
600 * The device will map a requested rate to a supported one, but the result
601 * of requests for rates greater than 1053257 is undefined (see AN205).
602 *
603 * CP2104, CP2105 and CP2110 support most rates up to 2M, 921k and 1M baud,
604 * respectively, with an error less than 1%. The actual rates are determined
605 * by
606 *
607 * div = round(freq / (2 x prescale x request))
608 * actual = freq / (2 x prescale x div)
609 *
610 * For CP2104 and CP2105 freq is 48Mhz and prescale is 4 for request <= 365bps
611 * or 1 otherwise.
612 * For CP2110 freq is 24Mhz and prescale is 4 for request <= 300bps or 1
613 * otherwise.
614 */
615static void cp210x_change_speed(struct tty_struct *tty,
616 struct usb_serial_port *port, struct ktermios *old_termios)
617{
618 u32 baud;
619
620 baud = tty->termios->c_ospeed;
621
622 /* This maps the requested rate to a rate valid on cp2102 or cp2103,
623 * or to an arbitrary rate in [1M,2M].
624 *
625 * NOTE: B0 is not implemented.
626 */
627 baud = cp210x_quantise_baudrate(baud);
628
629 dbg("%s - setting baud rate to %u", __func__, baud);
630 if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud,
631 sizeof(baud))) {
632 dev_warn(&port->dev, "failed to set baud rate to %u\n", baud);
633 if (old_termios)
634 baud = old_termios->c_ospeed;
635 else
636 baud = 9600;
637 }
638
639 tty_encode_baud_rate(tty, baud, baud);
640}
641
582static void cp210x_set_termios(struct tty_struct *tty, 642static void cp210x_set_termios(struct tty_struct *tty,
583 struct usb_serial_port *port, struct ktermios *old_termios) 643 struct usb_serial_port *port, struct ktermios *old_termios)
584{ 644{
585 unsigned int cflag, old_cflag; 645 unsigned int cflag, old_cflag;
586 unsigned int baud = 0, bits; 646 unsigned int bits;
587 unsigned int modem_ctl[4]; 647 unsigned int modem_ctl[4];
588 648
589 dbg("%s - port %d", __func__, port->number); 649 dbg("%s - port %d", __func__, port->number);
@@ -593,20 +653,9 @@ static void cp210x_set_termios(struct tty_struct *tty,
593 653
594 cflag = tty->termios->c_cflag; 654 cflag = tty->termios->c_cflag;
595 old_cflag = old_termios->c_cflag; 655 old_cflag = old_termios->c_cflag;
596 baud = cp210x_quantise_baudrate(tty_get_baud_rate(tty)); 656
597 657 if (tty->termios->c_ospeed != old_termios->c_ospeed)
598 /* If the baud rate is to be updated*/ 658 cp210x_change_speed(tty, port, old_termios);
599 if (baud != tty_termios_baud_rate(old_termios) && baud != 0) {
600 dbg("%s - Setting baud rate to %d baud", __func__,
601 baud);
602 if (cp210x_set_config_single(port, CP210X_SET_BAUDDIV,
603 ((BAUD_RATE_GEN_FREQ + baud/2) / baud))) {
604 dbg("Baud rate requested not supported by device");
605 baud = tty_termios_baud_rate(old_termios);
606 }
607 }
608 /* Report back the resulting baud rate */
609 tty_encode_baud_rate(tty, baud, baud);
610 659
611 /* If the number of data bits is to be updated */ 660 /* If the number of data bits is to be updated */
612 if ((cflag & CSIZE) != (old_cflag & CSIZE)) { 661 if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
@@ -636,13 +685,13 @@ static void cp210x_set_termios(struct tty_struct *tty,
636 default: 685 default:
637 dbg("cp210x driver does not " 686 dbg("cp210x driver does not "
638 "support the number of bits requested," 687 "support the number of bits requested,"
639 " using 8 bit mode\n"); 688 " using 8 bit mode");
640 bits |= BITS_DATA_8; 689 bits |= BITS_DATA_8;
641 break; 690 break;
642 } 691 }
643 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 692 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
644 dbg("Number of data bits requested " 693 dbg("Number of data bits requested "
645 "not supported by device\n"); 694 "not supported by device");
646 } 695 }
647 696
648 if ((cflag & (PARENB|PARODD|CMSPAR)) != 697 if ((cflag & (PARENB|PARODD|CMSPAR)) !=
@@ -669,8 +718,7 @@ static void cp210x_set_termios(struct tty_struct *tty,
669 } 718 }
670 } 719 }
671 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 720 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
672 dbg("Parity mode not supported " 721 dbg("Parity mode not supported by device");
673 "by device\n");
674 } 722 }
675 723
676 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { 724 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) {
@@ -685,7 +733,7 @@ static void cp210x_set_termios(struct tty_struct *tty,
685 } 733 }
686 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 734 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
687 dbg("Number of stop bits requested " 735 dbg("Number of stop bits requested "
688 "not supported by device\n"); 736 "not supported by device");
689 } 737 }
690 738
691 if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { 739 if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
@@ -802,35 +850,7 @@ static int cp210x_startup(struct usb_serial *serial)
802 return 0; 850 return 0;
803} 851}
804 852
805static int __init cp210x_init(void) 853module_usb_serial_driver(cp210x_driver, serial_drivers);
806{
807 int retval;
808
809 retval = usb_serial_register(&cp210x_device);
810 if (retval)
811 return retval; /* Failed to register */
812
813 retval = usb_register(&cp210x_driver);
814 if (retval) {
815 /* Failed to register */
816 usb_serial_deregister(&cp210x_device);
817 return retval;
818 }
819
820 /* Success */
821 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
822 DRIVER_DESC "\n");
823 return 0;
824}
825
826static void __exit cp210x_exit(void)
827{
828 usb_deregister(&cp210x_driver);
829 usb_serial_deregister(&cp210x_device);
830}
831
832module_init(cp210x_init);
833module_exit(cp210x_exit);
834 854
835MODULE_DESCRIPTION(DRIVER_DESC); 855MODULE_DESCRIPTION(DRIVER_DESC);
836MODULE_VERSION(DRIVER_VERSION); 856MODULE_VERSION(DRIVER_VERSION);
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index 6bc3802a581a..d39b9418f2fb 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 */
@@ -473,35 +475,7 @@ exit:
473 usb_serial_port_softint(port); 475 usb_serial_port_softint(port);
474} 476}
475 477
476static int __init cyberjack_init(void) 478module_usb_serial_driver(cyberjack_driver, serial_drivers);
477{
478 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
490 return 0;
491failed_usb_register:
492 usb_serial_deregister(&cyberjack_device);
493failed_usb_serial_register:
494 return retval;
495}
496
497static void __exit cyberjack_exit(void)
498{
499 usb_deregister(&cyberjack_driver);
500 usb_serial_deregister(&cyberjack_device);
501}
502
503module_init(cyberjack_init);
504module_exit(cyberjack_exit);
505 479
506MODULE_AUTHOR(DRIVER_AUTHOR); 480MODULE_AUTHOR(DRIVER_AUTHOR);
507MODULE_DESCRIPTION(DRIVER_DESC); 481MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 3bdeafa29c24..afc886c75d2f 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 *****************************************************************************/
@@ -800,7 +801,7 @@ send:
800 cypress_write_int_callback, port, priv->write_urb_interval); 801 cypress_write_int_callback, port, priv->write_urb_interval);
801 result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC); 802 result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC);
802 if (result) { 803 if (result) {
803 dev_err(&port->dev, 804 dev_err_console(port,
804 "%s - failed submitting write urb, error %d\n", 805 "%s - failed submitting write urb, error %d\n",
805 __func__, result); 806 __func__, result);
806 priv->write_urb_in_use = 0; 807 priv->write_urb_in_use = 0;
@@ -1345,58 +1346,7 @@ static void cypress_write_int_callback(struct urb *urb)
1345 cypress_send(port); 1346 cypress_send(port);
1346} 1347}
1347 1348
1348 1349module_usb_serial_driver(cypress_driver, serial_drivers);
1349/*****************************************************************************
1350 * Module functions
1351 *****************************************************************************/
1352
1353static int __init cypress_init(void)
1354{
1355 int retval;
1356
1357 dbg("%s", __func__);
1358
1359 retval = usb_serial_register(&cypress_earthmate_device);
1360 if (retval)
1361 goto failed_em_register;
1362 retval = usb_serial_register(&cypress_hidcom_device);
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;
1384}
1385
1386
1387static void __exit cypress_exit(void)
1388{
1389 dbg("%s", __func__);
1390
1391 usb_deregister(&cypress_driver);
1392 usb_serial_deregister(&cypress_earthmate_device);
1393 usb_serial_deregister(&cypress_hidcom_device);
1394 usb_serial_deregister(&cypress_ca42v2_device);
1395}
1396
1397
1398module_init(cypress_init);
1399module_exit(cypress_exit);
1400 1350
1401MODULE_AUTHOR(DRIVER_AUTHOR); 1351MODULE_AUTHOR(DRIVER_AUTHOR);
1402MODULE_DESCRIPTION(DRIVER_DESC); 1352MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index b23bebd721a1..999f91bf70de 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
337static 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
@@ -995,7 +995,7 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port,
995 /* return length of new data written, or error */ 995 /* return length of new data written, or error */
996 spin_unlock_irqrestore(&priv->dp_port_lock, flags); 996 spin_unlock_irqrestore(&priv->dp_port_lock, flags);
997 if (ret < 0) 997 if (ret < 0)
998 dev_err(&port->dev, 998 dev_err_console(port,
999 "%s: usb_submit_urb failed, ret=%d, port=%d\n", 999 "%s: usb_submit_urb failed, ret=%d, port=%d\n",
1000 __func__, ret, priv->dp_port_num); 1000 __func__, ret, priv->dp_port_num);
1001 dbg("digi_write: returning %d", ret); 1001 dbg("digi_write: returning %d", ret);
@@ -1065,7 +1065,7 @@ static void digi_write_bulk_callback(struct urb *urb)
1065 1065
1066 spin_unlock(&priv->dp_port_lock); 1066 spin_unlock(&priv->dp_port_lock);
1067 if (ret && ret != -EPERM) 1067 if (ret && ret != -EPERM)
1068 dev_err(&port->dev, 1068 dev_err_console(port,
1069 "%s: usb_submit_urb failed, ret=%d, port=%d\n", 1069 "%s: usb_submit_urb failed, ret=%d, port=%d\n",
1070 __func__, ret, priv->dp_port_num); 1070 __func__, ret, priv->dp_port_num);
1071} 1071}
@@ -1580,40 +1580,7 @@ static int digi_read_oob_callback(struct urb *urb)
1580 1580
1581} 1581}
1582 1582
1583static int __init digi_init(void) 1583module_usb_serial_driver(digi_driver, serial_drivers);
1584{
1585 int retval;
1586 retval = usb_serial_register(&digi_acceleport_2_device);
1587 if (retval)
1588 goto failed_acceleport_2_device;
1589 retval = usb_serial_register(&digi_acceleport_4_device);
1590 if (retval)
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;
1598failed_usb_register:
1599 usb_serial_deregister(&digi_acceleport_4_device);
1600failed_acceleport_4_device:
1601 usb_serial_deregister(&digi_acceleport_2_device);
1602failed_acceleport_2_device:
1603 return retval;
1604}
1605
1606static void __exit digi_exit (void)
1607{
1608 usb_deregister(&digi_driver);
1609 usb_serial_deregister(&digi_acceleport_2_device);
1610 usb_serial_deregister(&digi_acceleport_4_device);
1611}
1612
1613
1614module_init(digi_init);
1615module_exit(digi_exit);
1616
1617 1584
1618MODULE_AUTHOR(DRIVER_AUTHOR); 1585MODULE_AUTHOR(DRIVER_AUTHOR);
1619MODULE_DESCRIPTION(DRIVER_DESC); 1586MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index aced6817bf95..5b99fc09e327 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
62static struct usb_serial_driver empeg_device = { 61static 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
75static struct usb_serial_driver * const serial_drivers[] = {
76 &empeg_device, NULL
77};
78
77static int empeg_startup(struct usb_serial *serial) 79static int empeg_startup(struct usb_serial *serial)
78{ 80{
79 int r; 81 int r;
@@ -136,33 +138,7 @@ static void empeg_init_termios(struct tty_struct *tty)
136 tty_encode_baud_rate(tty, 115200, 115200); 138 tty_encode_baud_rate(tty, 115200, 115200);
137} 139}
138 140
139static int __init empeg_init(void) 141module_usb_serial_driver(empeg_driver, serial_drivers);
140{
141 int retval;
142
143 retval = usb_serial_register(&empeg_device);
144 if (retval)
145 return retval;
146 retval = usb_register(&empeg_driver);
147 if (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}
156
157static void __exit empeg_exit(void)
158{
159 usb_deregister(&empeg_driver);
160 usb_serial_deregister(&empeg_device);
161}
162
163
164module_init(empeg_init);
165module_exit(empeg_exit);
166 142
167MODULE_AUTHOR(DRIVER_AUTHOR); 143MODULE_AUTHOR(DRIVER_AUTHOR);
168MODULE_DESCRIPTION(DRIVER_DESC); 144MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
new file mode 100644
index 000000000000..88c0b1963920
--- /dev/null
+++ b/drivers/usb/serial/f81232.c
@@ -0,0 +1,405 @@
1/*
2 * Fintek F81232 USB to serial adaptor driver
3 *
4 * Copyright (C) 2012 Greg Kroah-Hartman (gregkh@linuxfoundation.org)
5 * Copyright (C) 2012 Linux Foundation
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 */
12
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/init.h>
16#include <linux/slab.h>
17#include <linux/tty.h>
18#include <linux/tty_driver.h>
19#include <linux/tty_flip.h>
20#include <linux/serial.h>
21#include <linux/module.h>
22#include <linux/moduleparam.h>
23#include <linux/spinlock.h>
24#include <linux/uaccess.h>
25#include <linux/usb.h>
26#include <linux/usb/serial.h>
27
28static bool debug;
29
30static const struct usb_device_id id_table[] = {
31 { USB_DEVICE(0x1934, 0x0706) },
32 { } /* Terminating entry */
33};
34MODULE_DEVICE_TABLE(usb, id_table);
35
36#define CONTROL_DTR 0x01
37#define CONTROL_RTS 0x02
38
39#define UART_STATE 0x08
40#define UART_STATE_TRANSIENT_MASK 0x74
41#define UART_DCD 0x01
42#define UART_DSR 0x02
43#define UART_BREAK_ERROR 0x04
44#define UART_RING 0x08
45#define UART_FRAME_ERROR 0x10
46#define UART_PARITY_ERROR 0x20
47#define UART_OVERRUN_ERROR 0x40
48#define UART_CTS 0x80
49
50struct f81232_private {
51 spinlock_t lock;
52 wait_queue_head_t delta_msr_wait;
53 u8 line_control;
54 u8 line_status;
55};
56
57static void f81232_update_line_status(struct usb_serial_port *port,
58 unsigned char *data,
59 unsigned int actual_length)
60{
61}
62
63static void f81232_read_int_callback(struct urb *urb)
64{
65 struct usb_serial_port *port = urb->context;
66 unsigned char *data = urb->transfer_buffer;
67 unsigned int actual_length = urb->actual_length;
68 int status = urb->status;
69 int retval;
70
71 dbg("%s (%d)", __func__, port->number);
72
73 switch (status) {
74 case 0:
75 /* success */
76 break;
77 case -ECONNRESET:
78 case -ENOENT:
79 case -ESHUTDOWN:
80 /* this urb is terminated, clean up */
81 dbg("%s - urb shutting down with status: %d", __func__,
82 status);
83 return;
84 default:
85 dbg("%s - nonzero urb status received: %d", __func__,
86 status);
87 goto exit;
88 }
89
90 usb_serial_debug_data(debug, &port->dev, __func__,
91 urb->actual_length, urb->transfer_buffer);
92
93 f81232_update_line_status(port, data, actual_length);
94
95exit:
96 retval = usb_submit_urb(urb, GFP_ATOMIC);
97 if (retval)
98 dev_err(&urb->dev->dev,
99 "%s - usb_submit_urb failed with result %d\n",
100 __func__, retval);
101}
102
103static void f81232_process_read_urb(struct urb *urb)
104{
105 struct usb_serial_port *port = urb->context;
106 struct f81232_private *priv = usb_get_serial_port_data(port);
107 struct tty_struct *tty;
108 unsigned char *data = urb->transfer_buffer;
109 char tty_flag = TTY_NORMAL;
110 unsigned long flags;
111 u8 line_status;
112 int i;
113
114 /* update line status */
115 spin_lock_irqsave(&priv->lock, flags);
116 line_status = priv->line_status;
117 priv->line_status &= ~UART_STATE_TRANSIENT_MASK;
118 spin_unlock_irqrestore(&priv->lock, flags);
119 wake_up_interruptible(&priv->delta_msr_wait);
120
121 if (!urb->actual_length)
122 return;
123
124 tty = tty_port_tty_get(&port->port);
125 if (!tty)
126 return;
127
128 /* break takes precedence over parity, */
129 /* which takes precedence over framing errors */
130 if (line_status & UART_BREAK_ERROR)
131 tty_flag = TTY_BREAK;
132 else if (line_status & UART_PARITY_ERROR)
133 tty_flag = TTY_PARITY;
134 else if (line_status & UART_FRAME_ERROR)
135 tty_flag = TTY_FRAME;
136 dbg("%s - tty_flag = %d", __func__, tty_flag);
137
138 /* overrun is special, not associated with a char */
139 if (line_status & UART_OVERRUN_ERROR)
140 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
141
142 if (port->port.console && port->sysrq) {
143 for (i = 0; i < urb->actual_length; ++i)
144 if (!usb_serial_handle_sysrq_char(port, data[i]))
145 tty_insert_flip_char(tty, data[i], tty_flag);
146 } else {
147 tty_insert_flip_string_fixed_flag(tty, data, tty_flag,
148 urb->actual_length);
149 }
150
151 tty_flip_buffer_push(tty);
152 tty_kref_put(tty);
153}
154
155static int set_control_lines(struct usb_device *dev, u8 value)
156{
157 /* FIXME - Stubbed out for now */
158 return 0;
159}
160
161static void f81232_break_ctl(struct tty_struct *tty, int break_state)
162{
163 /* FIXME - Stubbed out for now */
164
165 /*
166 * break_state = -1 to turn on break, and 0 to turn off break
167 * see drivers/char/tty_io.c to see it used.
168 * last_set_data_urb_value NEVER has the break bit set in it.
169 */
170}
171
172static void f81232_set_termios(struct tty_struct *tty,
173 struct usb_serial_port *port, struct ktermios *old_termios)
174{
175 /* FIXME - Stubbed out for now */
176
177 /* Don't change anything if nothing has changed */
178 if (!tty_termios_hw_change(tty->termios, old_termios))
179 return;
180
181 /* Do the real work here... */
182}
183
184static int f81232_tiocmget(struct tty_struct *tty)
185{
186 /* FIXME - Stubbed out for now */
187 return 0;
188}
189
190static int f81232_tiocmset(struct tty_struct *tty,
191 unsigned int set, unsigned int clear)
192{
193 /* FIXME - Stubbed out for now */
194 return 0;
195}
196
197static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
198{
199 struct ktermios tmp_termios;
200 int result;
201
202 /* Setup termios */
203 if (tty)
204 f81232_set_termios(tty, port, &tmp_termios);
205
206 dbg("%s - submitting interrupt urb", __func__);
207 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
208 if (result) {
209 dev_err(&port->dev, "%s - failed submitting interrupt urb,"
210 " error %d\n", __func__, result);
211 return result;
212 }
213
214 result = usb_serial_generic_open(tty, port);
215 if (result) {
216 usb_kill_urb(port->interrupt_in_urb);
217 return result;
218 }
219
220 port->port.drain_delay = 256;
221 return 0;
222}
223
224static void f81232_close(struct usb_serial_port *port)
225{
226 usb_serial_generic_close(port);
227 usb_kill_urb(port->interrupt_in_urb);
228}
229
230static void f81232_dtr_rts(struct usb_serial_port *port, int on)
231{
232 struct f81232_private *priv = usb_get_serial_port_data(port);
233 unsigned long flags;
234 u8 control;
235
236 spin_lock_irqsave(&priv->lock, flags);
237 /* Change DTR and RTS */
238 if (on)
239 priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
240 else
241 priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
242 control = priv->line_control;
243 spin_unlock_irqrestore(&priv->lock, flags);
244 set_control_lines(port->serial->dev, control);
245}
246
247static int f81232_carrier_raised(struct usb_serial_port *port)
248{
249 struct f81232_private *priv = usb_get_serial_port_data(port);
250 if (priv->line_status & UART_DCD)
251 return 1;
252 return 0;
253}
254
255static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
256{
257 struct f81232_private *priv = usb_get_serial_port_data(port);
258 unsigned long flags;
259 unsigned int prevstatus;
260 unsigned int status;
261 unsigned int changed;
262
263 spin_lock_irqsave(&priv->lock, flags);
264 prevstatus = priv->line_status;
265 spin_unlock_irqrestore(&priv->lock, flags);
266
267 while (1) {
268 interruptible_sleep_on(&priv->delta_msr_wait);
269 /* see if a signal did it */
270 if (signal_pending(current))
271 return -ERESTARTSYS;
272
273 spin_lock_irqsave(&priv->lock, flags);
274 status = priv->line_status;
275 spin_unlock_irqrestore(&priv->lock, flags);
276
277 changed = prevstatus ^ status;
278
279 if (((arg & TIOCM_RNG) && (changed & UART_RING)) ||
280 ((arg & TIOCM_DSR) && (changed & UART_DSR)) ||
281 ((arg & TIOCM_CD) && (changed & UART_DCD)) ||
282 ((arg & TIOCM_CTS) && (changed & UART_CTS))) {
283 return 0;
284 }
285 prevstatus = status;
286 }
287 /* NOTREACHED */
288 return 0;
289}
290
291static int f81232_ioctl(struct tty_struct *tty,
292 unsigned int cmd, unsigned long arg)
293{
294 struct serial_struct ser;
295 struct usb_serial_port *port = tty->driver_data;
296 dbg("%s (%d) cmd = 0x%04x", __func__, port->number, cmd);
297
298 switch (cmd) {
299 case TIOCGSERIAL:
300 memset(&ser, 0, sizeof ser);
301 ser.type = PORT_16654;
302 ser.line = port->serial->minor;
303 ser.port = port->number;
304 ser.baud_base = 460800;
305
306 if (copy_to_user((void __user *)arg, &ser, sizeof ser))
307 return -EFAULT;
308
309 return 0;
310
311 case TIOCMIWAIT:
312 dbg("%s (%d) TIOCMIWAIT", __func__, port->number);
313 return wait_modem_info(port, arg);
314 default:
315 dbg("%s not supported = 0x%04x", __func__, cmd);
316 break;
317 }
318 return -ENOIOCTLCMD;
319}
320
321static int f81232_startup(struct usb_serial *serial)
322{
323 struct f81232_private *priv;
324 int i;
325
326 for (i = 0; i < serial->num_ports; ++i) {
327 priv = kzalloc(sizeof(struct f81232_private), GFP_KERNEL);
328 if (!priv)
329 goto cleanup;
330 spin_lock_init(&priv->lock);
331 init_waitqueue_head(&priv->delta_msr_wait);
332 usb_set_serial_port_data(serial->port[i], priv);
333 }
334 return 0;
335
336cleanup:
337 for (--i; i >= 0; --i) {
338 priv = usb_get_serial_port_data(serial->port[i]);
339 kfree(priv);
340 usb_set_serial_port_data(serial->port[i], NULL);
341 }
342 return -ENOMEM;
343}
344
345static void f81232_release(struct usb_serial *serial)
346{
347 int i;
348 struct f81232_private *priv;
349
350 for (i = 0; i < serial->num_ports; ++i) {
351 priv = usb_get_serial_port_data(serial->port[i]);
352 kfree(priv);
353 }
354}
355
356static struct usb_driver f81232_driver = {
357 .name = "f81232",
358 .probe = usb_serial_probe,
359 .disconnect = usb_serial_disconnect,
360 .id_table = id_table,
361 .suspend = usb_serial_suspend,
362 .resume = usb_serial_resume,
363 .no_dynamic_id = 1,
364 .supports_autosuspend = 1,
365};
366
367static struct usb_serial_driver f81232_device = {
368 .driver = {
369 .owner = THIS_MODULE,
370 .name = "f81232",
371 },
372 .id_table = id_table,
373 .usb_driver = &f81232_driver,
374 .num_ports = 1,
375 .bulk_in_size = 256,
376 .bulk_out_size = 256,
377 .open = f81232_open,
378 .close = f81232_close,
379 .dtr_rts = f81232_dtr_rts,
380 .carrier_raised = f81232_carrier_raised,
381 .ioctl = f81232_ioctl,
382 .break_ctl = f81232_break_ctl,
383 .set_termios = f81232_set_termios,
384 .tiocmget = f81232_tiocmget,
385 .tiocmset = f81232_tiocmset,
386 .process_read_urb = f81232_process_read_urb,
387 .read_int_callback = f81232_read_int_callback,
388 .attach = f81232_startup,
389 .release = f81232_release,
390};
391
392static struct usb_serial_driver * const serial_drivers[] = {
393 &f81232_device,
394 NULL,
395};
396
397module_usb_serial_driver(f81232_driver, serial_drivers);
398
399MODULE_DESCRIPTION("Fintek F81232 USB to serial adaptor driver");
400MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@linuxfoundation.org");
401MODULE_LICENSE("GPL v2");
402
403module_param(debug, bool, S_IRUGO | S_IWUSR);
404MODULE_PARM_DESC(debug, "Debug enabled or not");
405
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 01b6404df395..989262606684 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -536,6 +536,10 @@ static struct usb_device_id id_table_combined [] = {
536 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_6_PID) }, 536 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_6_PID) },
537 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_7_PID) }, 537 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_7_PID) },
538 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, 538 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) },
539 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_1_PID) },
540 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_2_PID) },
541 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_3_PID) },
542 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_4_PID) },
539 { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, 543 { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) },
540 { USB_DEVICE(OCT_VID, OCT_US101_PID) }, 544 { USB_DEVICE(OCT_VID, OCT_US101_PID) },
541 { USB_DEVICE(OCT_VID, OCT_DK201_PID) }, 545 { USB_DEVICE(OCT_VID, OCT_DK201_PID) },
@@ -797,6 +801,7 @@ static struct usb_device_id id_table_combined [] = {
797 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 801 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
798 { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID), 802 { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID),
799 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 803 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
804 { USB_DEVICE(HORNBY_VID, HORNBY_ELITE_PID) },
800 { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, 805 { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) },
801 { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID), 806 { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID),
802 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 807 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
@@ -805,6 +810,8 @@ static struct usb_device_id id_table_combined [] = {
805 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) }, 810 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
806 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), 811 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
807 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 812 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
813 { USB_DEVICE(FTDI_VID, TI_XDS100V2_PID),
814 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
808 { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, 815 { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) },
809 { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) }, 816 { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) },
810 { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) }, 817 { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) },
@@ -836,11 +843,13 @@ static struct usb_device_id id_table_combined [] = {
836 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, 843 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) },
837 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, 844 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) },
838 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, 845 { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) },
846 { USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) },
839 { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, 847 { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
840 { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), 848 { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
841 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 849 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
842 { USB_DEVICE(ST_VID, ST_STMCLT1030_PID), 850 { USB_DEVICE(ST_VID, ST_STMCLT1030_PID),
843 .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk }, 851 .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk },
852 { USB_DEVICE(FTDI_VID, FTDI_RF_R106) },
844 { }, /* Optional parameter entry */ 853 { }, /* Optional parameter entry */
845 { } /* Terminating entry */ 854 { } /* Terminating entry */
846}; 855};
@@ -852,7 +861,6 @@ static struct usb_driver ftdi_driver = {
852 .probe = usb_serial_probe, 861 .probe = usb_serial_probe,
853 .disconnect = usb_serial_disconnect, 862 .disconnect = usb_serial_disconnect,
854 .id_table = id_table_combined, 863 .id_table = id_table_combined,
855 .no_dynamic_id = 1,
856}; 864};
857 865
858static const char *ftdi_chip_name[] = { 866static const char *ftdi_chip_name[] = {
@@ -910,7 +918,6 @@ static struct usb_serial_driver ftdi_sio_device = {
910 .name = "ftdi_sio", 918 .name = "ftdi_sio",
911 }, 919 },
912 .description = "FTDI USB Serial Device", 920 .description = "FTDI USB Serial Device",
913 .usb_driver = &ftdi_driver,
914 .id_table = id_table_combined, 921 .id_table = id_table_combined,
915 .num_ports = 1, 922 .num_ports = 1,
916 .bulk_in_size = 512, 923 .bulk_in_size = 512,
@@ -933,6 +940,10 @@ static struct usb_serial_driver ftdi_sio_device = {
933 .break_ctl = ftdi_break_ctl, 940 .break_ctl = ftdi_break_ctl,
934}; 941};
935 942
943static struct usb_serial_driver * const serial_drivers[] = {
944 &ftdi_sio_device, NULL
945};
946
936 947
937#define WDR_TIMEOUT 5000 /* default urb timeout */ 948#define WDR_TIMEOUT 5000 /* default urb timeout */
938#define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */ 949#define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */
@@ -1333,8 +1344,7 @@ static int set_serial_info(struct tty_struct *tty,
1333 goto check_and_exit; 1344 goto check_and_exit;
1334 } 1345 }
1335 1346
1336 if ((new_serial.baud_base != priv->baud_base) && 1347 if (new_serial.baud_base != priv->baud_base) {
1337 (new_serial.baud_base < 9600)) {
1338 mutex_unlock(&priv->cfg_lock); 1348 mutex_unlock(&priv->cfg_lock);
1339 return -EINVAL; 1349 return -EINVAL;
1340 } 1350 }
@@ -1759,7 +1769,8 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)
1759 1769
1760 dbg("%s", __func__); 1770 dbg("%s", __func__);
1761 1771
1762 if (strcmp(udev->manufacturer, "CALAO Systems") == 0) 1772 if ((udev->manufacturer) &&
1773 (strcmp(udev->manufacturer, "CALAO Systems") == 0))
1763 return ftdi_jtag_probe(serial); 1774 return ftdi_jtag_probe(serial);
1764 1775
1765 return 0; 1776 return 0;
@@ -1824,6 +1835,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port)
1824 1835
1825static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port) 1836static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)
1826{ 1837{
1838 struct ktermios dummy;
1827 struct usb_device *dev = port->serial->dev; 1839 struct usb_device *dev = port->serial->dev;
1828 struct ftdi_private *priv = usb_get_serial_port_data(port); 1840 struct ftdi_private *priv = usb_get_serial_port_data(port);
1829 int result; 1841 int result;
@@ -1842,8 +1854,10 @@ static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)
1842 This is same behaviour as serial.c/rs_open() - Kuba */ 1854 This is same behaviour as serial.c/rs_open() - Kuba */
1843 1855
1844 /* ftdi_set_termios will send usb control messages */ 1856 /* ftdi_set_termios will send usb control messages */
1845 if (tty) 1857 if (tty) {
1846 ftdi_set_termios(tty, port, tty->termios); 1858 memset(&dummy, 0, sizeof(dummy));
1859 ftdi_set_termios(tty, port, &dummy);
1860 }
1847 1861
1848 /* Start reading from the device */ 1862 /* Start reading from the device */
1849 result = usb_serial_generic_open(tty, port); 1863 result = usb_serial_generic_open(tty, port);
@@ -2413,19 +2427,10 @@ static int __init ftdi_init(void)
2413 id_table_combined[i].idVendor = vendor; 2427 id_table_combined[i].idVendor = vendor;
2414 id_table_combined[i].idProduct = product; 2428 id_table_combined[i].idProduct = product;
2415 } 2429 }
2416 retval = usb_serial_register(&ftdi_sio_device); 2430 retval = usb_serial_register_drivers(&ftdi_driver, serial_drivers);
2417 if (retval) 2431 if (retval == 0)
2418 goto failed_sio_register; 2432 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
2419 retval = usb_register(&ftdi_driver); 2433 DRIVER_DESC "\n");
2420 if (retval)
2421 goto failed_usb_register;
2422
2423 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
2424 DRIVER_DESC "\n");
2425 return 0;
2426failed_usb_register:
2427 usb_serial_deregister(&ftdi_sio_device);
2428failed_sio_register:
2429 return retval; 2434 return retval;
2430} 2435}
2431 2436
@@ -2433,8 +2438,7 @@ static void __exit ftdi_exit(void)
2433{ 2438{
2434 dbg("%s", __func__); 2439 dbg("%s", __func__);
2435 2440
2436 usb_deregister(&ftdi_driver); 2441 usb_serial_deregister_drivers(&ftdi_driver, serial_drivers);
2437 usb_serial_deregister(&ftdi_sio_device);
2438} 2442}
2439 2443
2440 2444
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index df1d7da933ec..ed74019c5b46 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -39,6 +39,13 @@
39/* www.candapter.com Ewert Energy Systems CANdapter device */ 39/* www.candapter.com Ewert Energy Systems CANdapter device */
40#define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */ 40#define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */
41 41
42/*
43 * Texas Instruments XDS100v2 JTAG / BeagleBone A3
44 * http://processors.wiki.ti.com/index.php/XDS100
45 * http://beagleboard.org/bone
46 */
47#define TI_XDS100V2_PID 0xa6d0
48
42#define FTDI_NXTCAM_PID 0xABB8 /* NXTCam for Mindstorms NXT */ 49#define FTDI_NXTCAM_PID 0xABB8 /* NXTCam for Mindstorms NXT */
43 50
44/* US Interface Navigator (http://www.usinterface.com/) */ 51/* US Interface Navigator (http://www.usinterface.com/) */
@@ -525,6 +532,12 @@
525#define ADI_GNICEPLUS_PID 0xF001 532#define ADI_GNICEPLUS_PID 0xF001
526 533
527/* 534/*
535 * Hornby Elite
536 */
537#define HORNBY_VID 0x04D8
538#define HORNBY_ELITE_PID 0x000A
539
540/*
528 * RATOC REX-USB60F 541 * RATOC REX-USB60F
529 */ 542 */
530#define RATOC_VENDOR_ID 0x0584 543#define RATOC_VENDOR_ID 0x0584
@@ -667,6 +680,10 @@
667#define SEALEVEL_2803_6_PID 0X2863 /* SeaLINK+8 (2803) Port 6 */ 680#define SEALEVEL_2803_6_PID 0X2863 /* SeaLINK+8 (2803) Port 6 */
668#define SEALEVEL_2803_7_PID 0X2873 /* SeaLINK+8 (2803) Port 7 */ 681#define SEALEVEL_2803_7_PID 0X2873 /* SeaLINK+8 (2803) Port 7 */
669#define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */ 682#define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */
683#define SEALEVEL_2803R_1_PID 0Xa02a /* SeaLINK+8 (2803-ROHS) Port 1+2 */
684#define SEALEVEL_2803R_2_PID 0Xa02b /* SeaLINK+8 (2803-ROHS) Port 3+4 */
685#define SEALEVEL_2803R_3_PID 0Xa02c /* SeaLINK+8 (2803-ROHS) Port 5+6 */
686#define SEALEVEL_2803R_4_PID 0Xa02d /* SeaLINK+8 (2803-ROHS) Port 7+8 */
670 687
671/* 688/*
672 * JETI SPECTROMETER SPECBOS 1201 689 * JETI SPECTROMETER SPECBOS 1201
@@ -1168,3 +1185,16 @@
1168 */ 1185 */
1169/* TagTracer MIFARE*/ 1186/* TagTracer MIFARE*/
1170#define FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID 0xF7C0 1187#define FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID 0xF7C0
1188
1189/*
1190 * Rainforest Automation
1191 */
1192/* ZigBee controller */
1193#define FTDI_RF_R106 0x8A28
1194
1195/*
1196 * Product: HCP HIT GPRS modem
1197 * Manufacturer: HCP d.o.o.
1198 * ATI command output: Cinterion MC55i
1199 */
1200#define FTDI_CINTERION_MC55I_PID 0xA951
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c
index 5d4b099dcf8b..4577b3607922 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
35static struct usb_serial_driver funsoft_device = { 34static struct usb_serial_driver funsoft_device = {
@@ -38,31 +37,15 @@ 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
45static int __init funsoft_init(void) 43static struct usb_serial_driver * const serial_drivers[] = {
46{ 44 &funsoft_device, NULL
47 int retval; 45};
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}
57 46
58static void __exit funsoft_exit(void) 47module_usb_serial_driver(funsoft_driver, serial_drivers);
59{
60 usb_deregister(&funsoft_driver);
61 usb_serial_deregister(&funsoft_device);
62}
63 48
64module_init(funsoft_init);
65module_exit(funsoft_exit);
66MODULE_LICENSE("GPL"); 49MODULE_LICENSE("GPL");
67 50
68module_param(debug, bool, S_IRUGO | S_IWUSR); 51module_param(debug, bool, S_IRUGO | S_IWUSR);
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 21343378c322..e8eb6347bf3a 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,40 +1512,11 @@ 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
1515static struct usb_serial_driver * const serial_drivers[] = {
1516 &garmin_device, NULL
1517};
1517 1518
1518 1519module_usb_serial_driver(garmin_driver, serial_drivers);
1519static int __init garmin_init(void)
1520{
1521 int retval;
1522
1523 retval = usb_serial_register(&garmin_device);
1524 if (retval)
1525 goto failed_garmin_register;
1526 retval = usb_register(&garmin_driver);
1527 if (retval)
1528 goto failed_usb_register;
1529 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1530 DRIVER_DESC "\n");
1531
1532 return 0;
1533failed_usb_register:
1534 usb_serial_deregister(&garmin_device);
1535failed_garmin_register:
1536 return retval;
1537}
1538
1539
1540static void __exit garmin_exit(void)
1541{
1542 usb_deregister(&garmin_driver);
1543 usb_serial_deregister(&garmin_device);
1544}
1545
1546
1547
1548
1549module_init(garmin_init);
1550module_exit(garmin_exit);
1551 1520
1552MODULE_AUTHOR(DRIVER_AUTHOR); 1521MODULE_AUTHOR(DRIVER_AUTHOR);
1553MODULE_DESCRIPTION(DRIVER_DESC); 1522MODULE_DESCRIPTION(DRIVER_DESC);
@@ -1557,4 +1526,3 @@ module_param(debug, bool, S_IWUSR | S_IRUGO);
1557MODULE_PARM_DESC(debug, "Debug enabled or not"); 1526MODULE_PARM_DESC(debug, "Debug enabled or not");
1558module_param(initial_mode, int, S_IRUGO); 1527module_param(initial_mode, int, S_IRUGO);
1559MODULE_PARM_DESC(initial_mode, "Initial mode"); 1528MODULE_PARM_DESC(initial_mode, "Initial mode");
1560
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index f7403576f99f..664deb63807c 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -54,7 +54,6 @@ static struct usb_driver generic_driver = {
54 .probe = generic_probe, 54 .probe = generic_probe,
55 .disconnect = usb_serial_disconnect, 55 .disconnect = usb_serial_disconnect,
56 .id_table = generic_serial_ids, 56 .id_table = generic_serial_ids,
57 .no_dynamic_id = 1,
58}; 57};
59 58
60/* All of the device info needed for the Generic Serial Converter */ 59/* All of the device info needed for the Generic Serial Converter */
@@ -64,7 +63,6 @@ struct usb_serial_driver usb_serial_generic_device = {
64 .name = "generic", 63 .name = "generic",
65 }, 64 },
66 .id_table = generic_device_ids, 65 .id_table = generic_device_ids,
67 .usb_driver = &generic_driver,
68 .num_ports = 1, 66 .num_ports = 1,
69 .disconnect = usb_serial_generic_disconnect, 67 .disconnect = usb_serial_generic_disconnect,
70 .release = usb_serial_generic_release, 68 .release = usb_serial_generic_release,
@@ -73,6 +71,10 @@ struct usb_serial_driver usb_serial_generic_device = {
73 .resume = usb_serial_generic_resume, 71 .resume = usb_serial_generic_resume,
74}; 72};
75 73
74static struct usb_serial_driver * const serial_drivers[] = {
75 &usb_serial_generic_device, NULL
76};
77
76static int generic_probe(struct usb_interface *interface, 78static int generic_probe(struct usb_interface *interface,
77 const struct usb_device_id *id) 79 const struct usb_device_id *id)
78{ 80{
@@ -97,13 +99,7 @@ int usb_serial_generic_register(int _debug)
97 USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT; 99 USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT;
98 100
99 /* register our generic driver with ourselves */ 101 /* register our generic driver with ourselves */
100 retval = usb_serial_register(&usb_serial_generic_device); 102 retval = usb_serial_register_drivers(&generic_driver, serial_drivers);
101 if (retval)
102 goto exit;
103 retval = usb_register(&generic_driver);
104 if (retval)
105 usb_serial_deregister(&usb_serial_generic_device);
106exit:
107#endif 103#endif
108 return retval; 104 return retval;
109} 105}
@@ -112,8 +108,7 @@ void usb_serial_generic_deregister(void)
112{ 108{
113#ifdef CONFIG_USB_SERIAL_GENERIC 109#ifdef CONFIG_USB_SERIAL_GENERIC
114 /* remove our generic driver */ 110 /* remove our generic driver */
115 usb_deregister(&generic_driver); 111 usb_serial_deregister_drivers(&generic_driver, serial_drivers);
116 usb_serial_deregister(&usb_serial_generic_device);
117#endif 112#endif
118} 113}
119 114
@@ -217,7 +212,7 @@ retry:
217 clear_bit(i, &port->write_urbs_free); 212 clear_bit(i, &port->write_urbs_free);
218 result = usb_submit_urb(urb, GFP_ATOMIC); 213 result = usb_submit_urb(urb, GFP_ATOMIC);
219 if (result) { 214 if (result) {
220 dev_err(&port->dev, "%s - error submitting urb: %d\n", 215 dev_err_console(port, "%s - error submitting urb: %d\n",
221 __func__, result); 216 __func__, result);
222 set_bit(i, &port->write_urbs_free); 217 set_bit(i, &port->write_urbs_free);
223 spin_lock_irqsave(&port->lock, flags); 218 spin_lock_irqsave(&port->lock, flags);
diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c
index 809379159b0e..2563e788c9b3 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
47static struct usb_serial_driver hp49gp_device = { 46static struct usb_serial_driver hp49gp_device = {
@@ -50,36 +49,14 @@ 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
57static int __init hp49gp_init(void) 55static struct usb_serial_driver * const serial_drivers[] = {
58{ 56 &hp49gp_device, NULL
59 int retval; 57};
60 retval = usb_serial_register(&hp49gp_device);
61 if (retval)
62 goto failed_usb_serial_register;
63 retval = usb_register(&hp49gp_driver);
64 if (retval)
65 goto failed_usb_register;
66 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
67 DRIVER_DESC "\n");
68 return 0;
69failed_usb_register:
70 usb_serial_deregister(&hp49gp_device);
71failed_usb_serial_register:
72 return retval;
73}
74
75static void __exit hp49gp_exit(void)
76{
77 usb_deregister(&hp49gp_driver);
78 usb_serial_deregister(&hp49gp_device);
79}
80 58
81module_init(hp49gp_init); 59module_usb_serial_driver(hp49gp_driver, serial_drivers);
82module_exit(hp49gp_exit);
83 60
84MODULE_DESCRIPTION(DRIVER_DESC); 61MODULE_DESCRIPTION(DRIVER_DESC);
85MODULE_VERSION(DRIVER_VERSION); 62MODULE_VERSION(DRIVER_VERSION);
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 0497575e4799..323e87235711 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -193,7 +193,8 @@ static const struct divisor_table_entry divisor_table[] = {
193/* local variables */ 193/* local variables */
194static bool debug; 194static bool debug;
195 195
196static atomic_t CmdUrbs; /* Number of outstanding Command Write Urbs */ 196/* Number of outstanding Command Write Urbs */
197static atomic_t CmdUrbs = ATOMIC_INIT(0);
197 198
198 199
199/* local function prototypes */ 200/* local function prototypes */
@@ -1286,7 +1287,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial,
1286 count = fifo->count; 1287 count = fifo->count;
1287 buffer = kmalloc(count+2, GFP_ATOMIC); 1288 buffer = kmalloc(count+2, GFP_ATOMIC);
1288 if (buffer == NULL) { 1289 if (buffer == NULL) {
1289 dev_err(&edge_port->port->dev, 1290 dev_err_console(edge_port->port,
1290 "%s - no more kernel memory...\n", __func__); 1291 "%s - no more kernel memory...\n", __func__);
1291 edge_port->write_in_progress = false; 1292 edge_port->write_in_progress = false;
1292 goto exit_send; 1293 goto exit_send;
@@ -1331,7 +1332,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial,
1331 status = usb_submit_urb(urb, GFP_ATOMIC); 1332 status = usb_submit_urb(urb, GFP_ATOMIC);
1332 if (status) { 1333 if (status) {
1333 /* something went wrong */ 1334 /* something went wrong */
1334 dev_err(&edge_port->port->dev, 1335 dev_err_console(edge_port->port,
1335 "%s - usb_submit_urb(write bulk) failed, status = %d, data lost\n", 1336 "%s - usb_submit_urb(write bulk) failed, status = %d, data lost\n",
1336 __func__, status); 1337 __func__, status);
1337 edge_port->write_in_progress = false; 1338 edge_port->write_in_progress = false;
@@ -3180,65 +3181,8 @@ static void edge_release(struct usb_serial *serial)
3180 kfree(edge_serial); 3181 kfree(edge_serial);
3181} 3182}
3182 3183
3184module_usb_serial_driver(io_driver, serial_drivers);
3183 3185
3184/****************************************************************************
3185 * edgeport_init
3186 * This is called by the module subsystem, or on startup to initialize us
3187 ****************************************************************************/
3188static int __init edgeport_init(void)
3189{
3190 int retval;
3191
3192 retval = usb_serial_register(&edgeport_2port_device);
3193 if (retval)
3194 goto failed_2port_device_register;
3195 retval = usb_serial_register(&edgeport_4port_device);
3196 if (retval)
3197 goto failed_4port_device_register;
3198 retval = usb_serial_register(&edgeport_8port_device);
3199 if (retval)
3200 goto failed_8port_device_register;
3201 retval = usb_serial_register(&epic_device);
3202 if (retval)
3203 goto failed_epic_device_register;
3204 retval = usb_register(&io_driver);
3205 if (retval)
3206 goto failed_usb_register;
3207 atomic_set(&CmdUrbs, 0);
3208 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
3209 DRIVER_DESC "\n");
3210 return 0;
3211
3212failed_usb_register:
3213 usb_serial_deregister(&epic_device);
3214failed_epic_device_register:
3215 usb_serial_deregister(&edgeport_8port_device);
3216failed_8port_device_register:
3217 usb_serial_deregister(&edgeport_4port_device);
3218failed_4port_device_register:
3219 usb_serial_deregister(&edgeport_2port_device);
3220failed_2port_device_register:
3221 return retval;
3222}
3223
3224
3225/****************************************************************************
3226 * edgeport_exit
3227 * Called when the driver is about to be unloaded.
3228 ****************************************************************************/
3229static void __exit edgeport_exit (void)
3230{
3231 usb_deregister(&io_driver);
3232 usb_serial_deregister(&edgeport_2port_device);
3233 usb_serial_deregister(&edgeport_4port_device);
3234 usb_serial_deregister(&edgeport_8port_device);
3235 usb_serial_deregister(&epic_device);
3236}
3237
3238module_init(edgeport_init);
3239module_exit(edgeport_exit);
3240
3241/* Module information */
3242MODULE_AUTHOR(DRIVER_AUTHOR); 3186MODULE_AUTHOR(DRIVER_AUTHOR);
3243MODULE_DESCRIPTION(DRIVER_DESC); 3187MODULE_DESCRIPTION(DRIVER_DESC);
3244MODULE_LICENSE("GPL"); 3188MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
index 178b22eb32b1..d0e7c9affb6f 100644
--- a/drivers/usb/serial/io_tables.h
+++ b/drivers/usb/serial/io_tables.h
@@ -100,7 +100,6 @@ static struct usb_driver io_driver = {
100 .probe = usb_serial_probe, 100 .probe = usb_serial_probe,
101 .disconnect = usb_serial_disconnect, 101 .disconnect = usb_serial_disconnect,
102 .id_table = id_table_combined, 102 .id_table = id_table_combined,
103 .no_dynamic_id = 1,
104}; 103};
105 104
106static struct usb_serial_driver edgeport_2port_device = { 105static struct usb_serial_driver edgeport_2port_device = {
@@ -109,7 +108,6 @@ static struct usb_serial_driver edgeport_2port_device = {
109 .name = "edgeport_2", 108 .name = "edgeport_2",
110 }, 109 },
111 .description = "Edgeport 2 port adapter", 110 .description = "Edgeport 2 port adapter",
112 .usb_driver = &io_driver,
113 .id_table = edgeport_2port_id_table, 111 .id_table = edgeport_2port_id_table,
114 .num_ports = 2, 112 .num_ports = 2,
115 .open = edge_open, 113 .open = edge_open,
@@ -139,7 +137,6 @@ static struct usb_serial_driver edgeport_4port_device = {
139 .name = "edgeport_4", 137 .name = "edgeport_4",
140 }, 138 },
141 .description = "Edgeport 4 port adapter", 139 .description = "Edgeport 4 port adapter",
142 .usb_driver = &io_driver,
143 .id_table = edgeport_4port_id_table, 140 .id_table = edgeport_4port_id_table,
144 .num_ports = 4, 141 .num_ports = 4,
145 .open = edge_open, 142 .open = edge_open,
@@ -169,7 +166,6 @@ static struct usb_serial_driver edgeport_8port_device = {
169 .name = "edgeport_8", 166 .name = "edgeport_8",
170 }, 167 },
171 .description = "Edgeport 8 port adapter", 168 .description = "Edgeport 8 port adapter",
172 .usb_driver = &io_driver,
173 .id_table = edgeport_8port_id_table, 169 .id_table = edgeport_8port_id_table,
174 .num_ports = 8, 170 .num_ports = 8,
175 .open = edge_open, 171 .open = edge_open,
@@ -199,7 +195,6 @@ static struct usb_serial_driver epic_device = {
199 .name = "epic", 195 .name = "epic",
200 }, 196 },
201 .description = "EPiC device", 197 .description = "EPiC device",
202 .usb_driver = &io_driver,
203 .id_table = Epic_port_id_table, 198 .id_table = Epic_port_id_table,
204 .num_ports = 1, 199 .num_ports = 1,
205 .open = edge_open, 200 .open = edge_open,
@@ -223,5 +218,10 @@ static struct usb_serial_driver epic_device = {
223 .write_bulk_callback = edge_bulk_out_data_callback, 218 .write_bulk_callback = edge_bulk_out_data_callback,
224}; 219};
225 220
221static struct usb_serial_driver * const serial_drivers[] = {
222 &edgeport_2port_device, &edgeport_4port_device,
223 &edgeport_8port_device, &epic_device, NULL
224};
225
226#endif 226#endif
227 227
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 65bf06aa591a..40a95a7fe383 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -202,7 +202,6 @@ static struct usb_driver io_driver = {
202 .probe = usb_serial_probe, 202 .probe = usb_serial_probe,
203 .disconnect = usb_serial_disconnect, 203 .disconnect = usb_serial_disconnect,
204 .id_table = id_table_combined, 204 .id_table = id_table_combined,
205 .no_dynamic_id = 1,
206}; 205};
207 206
208 207
@@ -1817,7 +1816,7 @@ static void edge_bulk_out_callback(struct urb *urb)
1817 __func__, status); 1816 __func__, status);
1818 return; 1817 return;
1819 default: 1818 default:
1820 dev_err(&urb->dev->dev, "%s - nonzero write bulk status " 1819 dev_err_console(port, "%s - nonzero write bulk status "
1821 "received: %d\n", __func__, status); 1820 "received: %d\n", __func__, status);
1822 } 1821 }
1823 1822
@@ -2111,7 +2110,7 @@ static void edge_send(struct tty_struct *tty)
2111 /* send the data out the bulk port */ 2110 /* send the data out the bulk port */
2112 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 2111 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
2113 if (result) { 2112 if (result) {
2114 dev_err(&port->dev, 2113 dev_err_console(port,
2115 "%s - failed submitting write urb, error %d\n", 2114 "%s - failed submitting write urb, error %d\n",
2116 __func__, result); 2115 __func__, result);
2117 edge_port->ep_write_urb_in_use = 0; 2116 edge_port->ep_write_urb_in_use = 0;
@@ -2657,15 +2656,7 @@ cleanup:
2657 2656
2658static void edge_disconnect(struct usb_serial *serial) 2657static void edge_disconnect(struct usb_serial *serial)
2659{ 2658{
2660 int i;
2661 struct edgeport_port *edge_port;
2662
2663 dbg("%s", __func__); 2659 dbg("%s", __func__);
2664
2665 for (i = 0; i < serial->num_ports; ++i) {
2666 edge_port = usb_get_serial_port_data(serial->port[i]);
2667 edge_remove_sysfs_attrs(edge_port->port);
2668 }
2669} 2660}
2670 2661
2671static void edge_release(struct usb_serial *serial) 2662static void edge_release(struct usb_serial *serial)
@@ -2733,7 +2724,6 @@ static struct usb_serial_driver edgeport_1port_device = {
2733 .name = "edgeport_ti_1", 2724 .name = "edgeport_ti_1",
2734 }, 2725 },
2735 .description = "Edgeport TI 1 port adapter", 2726 .description = "Edgeport TI 1 port adapter",
2736 .usb_driver = &io_driver,
2737 .id_table = edgeport_1port_id_table, 2727 .id_table = edgeport_1port_id_table,
2738 .num_ports = 1, 2728 .num_ports = 1,
2739 .open = edge_open, 2729 .open = edge_open,
@@ -2744,6 +2734,7 @@ static struct usb_serial_driver edgeport_1port_device = {
2744 .disconnect = edge_disconnect, 2734 .disconnect = edge_disconnect,
2745 .release = edge_release, 2735 .release = edge_release,
2746 .port_probe = edge_create_sysfs_attrs, 2736 .port_probe = edge_create_sysfs_attrs,
2737 .port_remove = edge_remove_sysfs_attrs,
2747 .ioctl = edge_ioctl, 2738 .ioctl = edge_ioctl,
2748 .set_termios = edge_set_termios, 2739 .set_termios = edge_set_termios,
2749 .tiocmget = edge_tiocmget, 2740 .tiocmget = edge_tiocmget,
@@ -2764,7 +2755,6 @@ static struct usb_serial_driver edgeport_2port_device = {
2764 .name = "edgeport_ti_2", 2755 .name = "edgeport_ti_2",
2765 }, 2756 },
2766 .description = "Edgeport TI 2 port adapter", 2757 .description = "Edgeport TI 2 port adapter",
2767 .usb_driver = &io_driver,
2768 .id_table = edgeport_2port_id_table, 2758 .id_table = edgeport_2port_id_table,
2769 .num_ports = 2, 2759 .num_ports = 2,
2770 .open = edge_open, 2760 .open = edge_open,
@@ -2775,6 +2765,7 @@ static struct usb_serial_driver edgeport_2port_device = {
2775 .disconnect = edge_disconnect, 2765 .disconnect = edge_disconnect,
2776 .release = edge_release, 2766 .release = edge_release,
2777 .port_probe = edge_create_sysfs_attrs, 2767 .port_probe = edge_create_sysfs_attrs,
2768 .port_remove = edge_remove_sysfs_attrs,
2778 .ioctl = edge_ioctl, 2769 .ioctl = edge_ioctl,
2779 .set_termios = edge_set_termios, 2770 .set_termios = edge_set_termios,
2780 .tiocmget = edge_tiocmget, 2771 .tiocmget = edge_tiocmget,
@@ -2788,41 +2779,12 @@ static struct usb_serial_driver edgeport_2port_device = {
2788 .write_bulk_callback = edge_bulk_out_callback, 2779 .write_bulk_callback = edge_bulk_out_callback,
2789}; 2780};
2790 2781
2782static struct usb_serial_driver * const serial_drivers[] = {
2783 &edgeport_1port_device, &edgeport_2port_device, NULL
2784};
2791 2785
2792static int __init edgeport_init(void) 2786module_usb_serial_driver(io_driver, serial_drivers);
2793{
2794 int retval;
2795 retval = usb_serial_register(&edgeport_1port_device);
2796 if (retval)
2797 goto failed_1port_device_register;
2798 retval = usb_serial_register(&edgeport_2port_device);
2799 if (retval)
2800 goto failed_2port_device_register;
2801 retval = usb_register(&io_driver);
2802 if (retval)
2803 goto failed_usb_register;
2804 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
2805 DRIVER_DESC "\n");
2806 return 0;
2807failed_usb_register:
2808 usb_serial_deregister(&edgeport_2port_device);
2809failed_2port_device_register:
2810 usb_serial_deregister(&edgeport_1port_device);
2811failed_1port_device_register:
2812 return retval;
2813}
2814
2815static void __exit edgeport_exit(void)
2816{
2817 usb_deregister(&io_driver);
2818 usb_serial_deregister(&edgeport_1port_device);
2819 usb_serial_deregister(&edgeport_2port_device);
2820}
2821
2822module_init(edgeport_init);
2823module_exit(edgeport_exit);
2824 2787
2825/* Module information */
2826MODULE_AUTHOR(DRIVER_AUTHOR); 2788MODULE_AUTHOR(DRIVER_AUTHOR);
2827MODULE_DESCRIPTION(DRIVER_DESC); 2789MODULE_DESCRIPTION(DRIVER_DESC);
2828MODULE_LICENSE("GPL"); 2790MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index 06053a920dd8..10c02b8b5664 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -510,7 +510,6 @@ static struct usb_driver ipaq_driver = {
510 .probe = usb_serial_probe, 510 .probe = usb_serial_probe,
511 .disconnect = usb_serial_disconnect, 511 .disconnect = usb_serial_disconnect,
512 .id_table = ipaq_id_table, 512 .id_table = ipaq_id_table,
513 .no_dynamic_id = 1,
514}; 513};
515 514
516 515
@@ -521,7 +520,6 @@ static struct usb_serial_driver ipaq_device = {
521 .name = "ipaq", 520 .name = "ipaq",
522 }, 521 },
523 .description = "PocketPC PDA", 522 .description = "PocketPC PDA",
524 .usb_driver = &ipaq_driver,
525 .id_table = ipaq_id_table, 523 .id_table = ipaq_id_table,
526 .bulk_in_size = 256, 524 .bulk_in_size = 256,
527 .bulk_out_size = 256, 525 .bulk_out_size = 256,
@@ -530,6 +528,10 @@ static struct usb_serial_driver ipaq_device = {
530 .calc_num_ports = ipaq_calc_num_ports, 528 .calc_num_ports = ipaq_calc_num_ports,
531}; 529};
532 530
531static struct usb_serial_driver * const serial_drivers[] = {
532 &ipaq_device, NULL
533};
534
533static int ipaq_open(struct tty_struct *tty, 535static int ipaq_open(struct tty_struct *tty,
534 struct usb_serial_port *port) 536 struct usb_serial_port *port)
535{ 537{
@@ -624,30 +626,22 @@ static int ipaq_startup(struct usb_serial *serial)
624static int __init ipaq_init(void) 626static int __init ipaq_init(void)
625{ 627{
626 int retval; 628 int retval;
627 retval = usb_serial_register(&ipaq_device); 629
628 if (retval)
629 goto failed_usb_serial_register;
630 if (vendor) { 630 if (vendor) {
631 ipaq_id_table[0].idVendor = vendor; 631 ipaq_id_table[0].idVendor = vendor;
632 ipaq_id_table[0].idProduct = product; 632 ipaq_id_table[0].idProduct = product;
633 } 633 }
634 retval = usb_register(&ipaq_driver); 634
635 if (retval) 635 retval = usb_serial_register_drivers(&ipaq_driver, serial_drivers);
636 goto failed_usb_register; 636 if (retval == 0)
637 637 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
638 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" 638 DRIVER_DESC "\n");
639 DRIVER_DESC "\n");
640 return 0;
641failed_usb_register:
642 usb_serial_deregister(&ipaq_device);
643failed_usb_serial_register:
644 return retval; 639 return retval;
645} 640}
646 641
647static void __exit ipaq_exit(void) 642static void __exit ipaq_exit(void)
648{ 643{
649 usb_deregister(&ipaq_driver); 644 usb_serial_deregister_drivers(&ipaq_driver, serial_drivers);
650 usb_serial_deregister(&ipaq_device);
651} 645}
652 646
653 647
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index 6f9356f3f99e..76a06406e26a 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -144,7 +144,6 @@ static struct usb_driver usb_ipw_driver = {
144 .probe = usb_serial_probe, 144 .probe = usb_serial_probe,
145 .disconnect = usb_serial_disconnect, 145 .disconnect = usb_serial_disconnect,
146 .id_table = usb_ipw_ids, 146 .id_table = usb_ipw_ids,
147 .no_dynamic_id = 1,
148}; 147};
149 148
150static bool debug; 149static bool debug;
@@ -318,7 +317,6 @@ static struct usb_serial_driver ipw_device = {
318 .name = "ipw", 317 .name = "ipw",
319 }, 318 },
320 .description = "IPWireless converter", 319 .description = "IPWireless converter",
321 .usb_driver = &usb_ipw_driver,
322 .id_table = usb_ipw_ids, 320 .id_table = usb_ipw_ids,
323 .num_ports = 1, 321 .num_ports = 1,
324 .disconnect = usb_wwan_disconnect, 322 .disconnect = usb_wwan_disconnect,
@@ -331,33 +329,11 @@ static struct usb_serial_driver ipw_device = {
331 .write = usb_wwan_write, 329 .write = usb_wwan_write,
332}; 330};
333 331
332static struct usb_serial_driver * const serial_drivers[] = {
333 &ipw_device, NULL
334};
334 335
335 336module_usb_serial_driver(usb_ipw_driver, serial_drivers);
336static int __init usb_ipw_init(void)
337{
338 int retval;
339
340 retval = usb_serial_register(&ipw_device);
341 if (retval)
342 return retval;
343 retval = usb_register(&usb_ipw_driver);
344 if (retval) {
345 usb_serial_deregister(&ipw_device);
346 return retval;
347 }
348 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
349 DRIVER_DESC "\n");
350 return 0;
351}
352
353static void __exit usb_ipw_exit(void)
354{
355 usb_deregister(&usb_ipw_driver);
356 usb_serial_deregister(&ipw_device);
357}
358
359module_init(usb_ipw_init);
360module_exit(usb_ipw_exit);
361 337
362/* Module information */ 338/* Module information */
363MODULE_AUTHOR(DRIVER_AUTHOR); 339MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index 84a396e83671..84965cd65c76 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -82,7 +82,6 @@ static struct usb_driver ir_driver = {
82 .probe = usb_serial_probe, 82 .probe = usb_serial_probe,
83 .disconnect = usb_serial_disconnect, 83 .disconnect = usb_serial_disconnect,
84 .id_table = ir_id_table, 84 .id_table = ir_id_table,
85 .no_dynamic_id = 1,
86}; 85};
87 86
88static struct usb_serial_driver ir_device = { 87static struct usb_serial_driver ir_device = {
@@ -91,7 +90,6 @@ static struct usb_serial_driver ir_device = {
91 .name = "ir-usb", 90 .name = "ir-usb",
92 }, 91 },
93 .description = "IR Dongle", 92 .description = "IR Dongle",
94 .usb_driver = &ir_driver,
95 .id_table = ir_id_table, 93 .id_table = ir_id_table,
96 .num_ports = 1, 94 .num_ports = 1,
97 .set_termios = ir_set_termios, 95 .set_termios = ir_set_termios,
@@ -101,6 +99,10 @@ static struct usb_serial_driver ir_device = {
101 .process_read_urb = ir_process_read_urb, 99 .process_read_urb = ir_process_read_urb,
102}; 100};
103 101
102static struct usb_serial_driver * const serial_drivers[] = {
103 &ir_device, NULL
104};
105
104static inline void irda_usb_dump_class_desc(struct usb_irda_cs_descriptor *desc) 106static inline void irda_usb_dump_class_desc(struct usb_irda_cs_descriptor *desc)
105{ 107{
106 dbg("bLength=%x", desc->bLength); 108 dbg("bLength=%x", desc->bLength);
@@ -445,30 +447,16 @@ static int __init ir_init(void)
445 ir_device.bulk_out_size = buffer_size; 447 ir_device.bulk_out_size = buffer_size;
446 } 448 }
447 449
448 retval = usb_serial_register(&ir_device); 450 retval = usb_serial_register_drivers(&ir_driver, serial_drivers);
449 if (retval) 451 if (retval == 0)
450 goto failed_usb_serial_register; 452 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
451 453 DRIVER_DESC "\n");
452 retval = usb_register(&ir_driver);
453 if (retval)
454 goto failed_usb_register;
455
456 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
457 DRIVER_DESC "\n");
458
459 return 0;
460
461failed_usb_register:
462 usb_serial_deregister(&ir_device);
463
464failed_usb_serial_register:
465 return retval; 454 return retval;
466} 455}
467 456
468static void __exit ir_exit(void) 457static void __exit ir_exit(void)
469{ 458{
470 usb_deregister(&ir_driver); 459 usb_serial_deregister_drivers(&ir_driver, serial_drivers);
471 usb_serial_deregister(&ir_device);
472} 460}
473 461
474 462
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 3077a4436976..f2192d527db0 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -56,7 +56,6 @@ static struct usb_driver iuu_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/* turbo parameter */ 61/* turbo parameter */
@@ -1274,7 +1273,6 @@ static struct usb_serial_driver iuu_device = {
1274 .name = "iuu_phoenix", 1273 .name = "iuu_phoenix",
1275 }, 1274 },
1276 .id_table = id_table, 1275 .id_table = id_table,
1277 .usb_driver = &iuu_driver,
1278 .num_ports = 1, 1276 .num_ports = 1,
1279 .bulk_in_size = 512, 1277 .bulk_in_size = 512,
1280 .bulk_out_size = 512, 1278 .bulk_out_size = 512,
@@ -1292,32 +1290,11 @@ static struct usb_serial_driver iuu_device = {
1292 .release = iuu_release, 1290 .release = iuu_release,
1293}; 1291};
1294 1292
1295static int __init iuu_init(void) 1293static struct usb_serial_driver * const serial_drivers[] = {
1296{ 1294 &iuu_device, NULL
1297 int retval; 1295};
1298 retval = usb_serial_register(&iuu_device);
1299 if (retval)
1300 goto failed_usb_serial_register;
1301 retval = usb_register(&iuu_driver);
1302 if (retval)
1303 goto failed_usb_register;
1304 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1305 DRIVER_DESC "\n");
1306 return 0;
1307failed_usb_register:
1308 usb_serial_deregister(&iuu_device);
1309failed_usb_serial_register:
1310 return retval;
1311}
1312
1313static void __exit iuu_exit(void)
1314{
1315 usb_deregister(&iuu_driver);
1316 usb_serial_deregister(&iuu_device);
1317}
1318 1296
1319module_init(iuu_init); 1297module_usb_serial_driver(iuu_driver, serial_drivers);
1320module_exit(iuu_exit);
1321 1298
1322MODULE_AUTHOR("Alain Degreffe eczema@ecze.com"); 1299MODULE_AUTHOR("Alain Degreffe eczema@ecze.com");
1323 1300
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 4cc36c761801..a39ddd1b0dca 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -130,53 +130,7 @@ struct keyspan_port_private {
130#include "keyspan_usa67msg.h" 130#include "keyspan_usa67msg.h"
131 131
132 132
133/* Functions used by new usb-serial code. */ 133module_usb_serial_driver(keyspan_driver, serial_drivers);
134static int __init keyspan_init(void)
135{
136 int retval;
137 retval = usb_serial_register(&keyspan_pre_device);
138 if (retval)
139 goto failed_pre_device_register;
140 retval = usb_serial_register(&keyspan_1port_device);
141 if (retval)
142 goto failed_1port_device_register;
143 retval = usb_serial_register(&keyspan_2port_device);
144 if (retval)
145 goto failed_2port_device_register;
146 retval = usb_serial_register(&keyspan_4port_device);
147 if (retval)
148 goto failed_4port_device_register;
149 retval = usb_register(&keyspan_driver);
150 if (retval)
151 goto failed_usb_register;
152
153 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
154 DRIVER_DESC "\n");
155
156 return 0;
157failed_usb_register:
158 usb_serial_deregister(&keyspan_4port_device);
159failed_4port_device_register:
160 usb_serial_deregister(&keyspan_2port_device);
161failed_2port_device_register:
162 usb_serial_deregister(&keyspan_1port_device);
163failed_1port_device_register:
164 usb_serial_deregister(&keyspan_pre_device);
165failed_pre_device_register:
166 return retval;
167}
168
169static void __exit keyspan_exit(void)
170{
171 usb_deregister(&keyspan_driver);
172 usb_serial_deregister(&keyspan_pre_device);
173 usb_serial_deregister(&keyspan_1port_device);
174 usb_serial_deregister(&keyspan_2port_device);
175 usb_serial_deregister(&keyspan_4port_device);
176}
177
178module_init(keyspan_init);
179module_exit(keyspan_exit);
180 134
181static void keyspan_break_ctl(struct tty_struct *tty, int break_state) 135static void keyspan_break_ctl(struct tty_struct *tty, int break_state)
182{ 136{
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index 13fa1d1cc900..622853c9e384 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -492,7 +492,6 @@ static struct usb_driver keyspan_driver = {
492 .probe = usb_serial_probe, 492 .probe = usb_serial_probe,
493 .disconnect = usb_serial_disconnect, 493 .disconnect = usb_serial_disconnect,
494 .id_table = keyspan_ids_combined, 494 .id_table = keyspan_ids_combined,
495 .no_dynamic_id = 1,
496}; 495};
497 496
498/* usb_device_id table for the pre-firmware download keyspan devices */ 497/* usb_device_id table for the pre-firmware download keyspan devices */
@@ -545,7 +544,6 @@ static struct usb_serial_driver keyspan_pre_device = {
545 .name = "keyspan_no_firm", 544 .name = "keyspan_no_firm",
546 }, 545 },
547 .description = "Keyspan - (without firmware)", 546 .description = "Keyspan - (without firmware)",
548 .usb_driver = &keyspan_driver,
549 .id_table = keyspan_pre_ids, 547 .id_table = keyspan_pre_ids,
550 .num_ports = 1, 548 .num_ports = 1,
551 .attach = keyspan_fake_startup, 549 .attach = keyspan_fake_startup,
@@ -557,7 +555,6 @@ static struct usb_serial_driver keyspan_1port_device = {
557 .name = "keyspan_1", 555 .name = "keyspan_1",
558 }, 556 },
559 .description = "Keyspan 1 port adapter", 557 .description = "Keyspan 1 port adapter",
560 .usb_driver = &keyspan_driver,
561 .id_table = keyspan_1port_ids, 558 .id_table = keyspan_1port_ids,
562 .num_ports = 1, 559 .num_ports = 1,
563 .open = keyspan_open, 560 .open = keyspan_open,
@@ -580,7 +577,6 @@ static struct usb_serial_driver keyspan_2port_device = {
580 .name = "keyspan_2", 577 .name = "keyspan_2",
581 }, 578 },
582 .description = "Keyspan 2 port adapter", 579 .description = "Keyspan 2 port adapter",
583 .usb_driver = &keyspan_driver,
584 .id_table = keyspan_2port_ids, 580 .id_table = keyspan_2port_ids,
585 .num_ports = 2, 581 .num_ports = 2,
586 .open = keyspan_open, 582 .open = keyspan_open,
@@ -603,7 +599,6 @@ static struct usb_serial_driver keyspan_4port_device = {
603 .name = "keyspan_4", 599 .name = "keyspan_4",
604 }, 600 },
605 .description = "Keyspan 4 port adapter", 601 .description = "Keyspan 4 port adapter",
606 .usb_driver = &keyspan_driver,
607 .id_table = keyspan_4port_ids, 602 .id_table = keyspan_4port_ids,
608 .num_ports = 4, 603 .num_ports = 4,
609 .open = keyspan_open, 604 .open = keyspan_open,
@@ -620,4 +615,9 @@ static struct usb_serial_driver keyspan_4port_device = {
620 .release = keyspan_release, 615 .release = keyspan_release,
621}; 616};
622 617
618static struct usb_serial_driver * const serial_drivers[] = {
619 &keyspan_pre_device, &keyspan_1port_device,
620 &keyspan_2port_device, &keyspan_4port_device, NULL
621};
622
623#endif 623#endif
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 7c62a7048302..693bcdfcb3d5 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -91,7 +91,6 @@ static struct usb_driver keyspan_pda_driver = {
91 .probe = usb_serial_probe, 91 .probe = usb_serial_probe,
92 .disconnect = usb_serial_disconnect, 92 .disconnect = usb_serial_disconnect,
93 .id_table = id_table_combined, 93 .id_table = id_table_combined,
94 .no_dynamic_id = 1,
95}; 94};
96 95
97static const struct usb_device_id id_table_std[] = { 96static const struct usb_device_id id_table_std[] = {
@@ -779,7 +778,6 @@ static struct usb_serial_driver keyspan_pda_fake_device = {
779 .name = "keyspan_pda_pre", 778 .name = "keyspan_pda_pre",
780 }, 779 },
781 .description = "Keyspan PDA - (prerenumeration)", 780 .description = "Keyspan PDA - (prerenumeration)",
782 .usb_driver = &keyspan_pda_driver,
783 .id_table = id_table_fake, 781 .id_table = id_table_fake,
784 .num_ports = 1, 782 .num_ports = 1,
785 .attach = keyspan_pda_fake_startup, 783 .attach = keyspan_pda_fake_startup,
@@ -793,7 +791,6 @@ static struct usb_serial_driver xircom_pgs_fake_device = {
793 .name = "xircom_no_firm", 791 .name = "xircom_no_firm",
794 }, 792 },
795 .description = "Xircom / Entregra PGS - (prerenumeration)", 793 .description = "Xircom / Entregra PGS - (prerenumeration)",
796 .usb_driver = &keyspan_pda_driver,
797 .id_table = id_table_fake_xircom, 794 .id_table = id_table_fake_xircom,
798 .num_ports = 1, 795 .num_ports = 1,
799 .attach = keyspan_pda_fake_startup, 796 .attach = keyspan_pda_fake_startup,
@@ -806,7 +803,6 @@ static struct usb_serial_driver keyspan_pda_device = {
806 .name = "keyspan_pda", 803 .name = "keyspan_pda",
807 }, 804 },
808 .description = "Keyspan PDA", 805 .description = "Keyspan PDA",
809 .usb_driver = &keyspan_pda_driver,
810 .id_table = id_table_std, 806 .id_table = id_table_std,
811 .num_ports = 1, 807 .num_ports = 1,
812 .dtr_rts = keyspan_pda_dtr_rts, 808 .dtr_rts = keyspan_pda_dtr_rts,
@@ -827,61 +823,18 @@ static struct usb_serial_driver keyspan_pda_device = {
827 .release = keyspan_pda_release, 823 .release = keyspan_pda_release,
828}; 824};
829 825
830 826static struct usb_serial_driver * const serial_drivers[] = {
831static int __init keyspan_pda_init(void) 827 &keyspan_pda_device,
832{
833 int retval;
834 retval = usb_serial_register(&keyspan_pda_device);
835 if (retval)
836 goto failed_pda_register;
837#ifdef KEYSPAN 828#ifdef KEYSPAN
838 retval = usb_serial_register(&keyspan_pda_fake_device); 829 &keyspan_pda_fake_device,
839 if (retval)
840 goto failed_pda_fake_register;
841#endif 830#endif
842#ifdef XIRCOM 831#ifdef XIRCOM
843 retval = usb_serial_register(&xircom_pgs_fake_device); 832 &xircom_pgs_fake_device,
844 if (retval)
845 goto failed_xircom_register;
846#endif
847 retval = usb_register(&keyspan_pda_driver);
848 if (retval)
849 goto failed_usb_register;
850 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
851 DRIVER_DESC "\n");
852 return 0;
853failed_usb_register:
854#ifdef XIRCOM
855 usb_serial_deregister(&xircom_pgs_fake_device);
856failed_xircom_register:
857#endif /* XIRCOM */
858#ifdef KEYSPAN
859 usb_serial_deregister(&keyspan_pda_fake_device);
860#endif
861#ifdef KEYSPAN
862failed_pda_fake_register:
863#endif 833#endif
864 usb_serial_deregister(&keyspan_pda_device); 834 NULL
865failed_pda_register: 835};
866 return retval;
867}
868
869
870static void __exit keyspan_pda_exit(void)
871{
872 usb_deregister(&keyspan_pda_driver);
873 usb_serial_deregister(&keyspan_pda_device);
874#ifdef KEYSPAN
875 usb_serial_deregister(&keyspan_pda_fake_device);
876#endif
877#ifdef XIRCOM
878 usb_serial_deregister(&xircom_pgs_fake_device);
879#endif
880}
881
882 836
883module_init(keyspan_pda_init); 837module_usb_serial_driver(keyspan_pda_driver, serial_drivers);
884module_exit(keyspan_pda_exit);
885 838
886MODULE_AUTHOR(DRIVER_AUTHOR); 839MODULE_AUTHOR(DRIVER_AUTHOR);
887MODULE_DESCRIPTION(DRIVER_DESC); 840MODULE_DESCRIPTION(DRIVER_DESC);
@@ -889,4 +842,3 @@ MODULE_LICENSE("GPL");
889 842
890module_param(debug, bool, S_IRUGO | S_IWUSR); 843module_param(debug, bool, S_IRUGO | S_IWUSR);
891MODULE_PARM_DESC(debug, "Debug enabled or not"); 844MODULE_PARM_DESC(debug, "Debug enabled or not");
892
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index fc064e1442ca..10f05407e535 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -91,7 +91,6 @@ static struct usb_driver kl5kusb105d_driver = {
91 .probe = usb_serial_probe, 91 .probe = usb_serial_probe,
92 .disconnect = usb_serial_disconnect, 92 .disconnect = usb_serial_disconnect,
93 .id_table = id_table, 93 .id_table = id_table,
94 .no_dynamic_id = 1,
95}; 94};
96 95
97static struct usb_serial_driver kl5kusb105d_device = { 96static struct usb_serial_driver kl5kusb105d_device = {
@@ -100,7 +99,6 @@ static struct usb_serial_driver kl5kusb105d_device = {
100 .name = "kl5kusb105d", 99 .name = "kl5kusb105d",
101 }, 100 },
102 .description = "KL5KUSB105D / PalmConnect", 101 .description = "KL5KUSB105D / PalmConnect",
103 .usb_driver = &kl5kusb105d_driver,
104 .id_table = id_table, 102 .id_table = id_table,
105 .num_ports = 1, 103 .num_ports = 1,
106 .bulk_out_size = 64, 104 .bulk_out_size = 64,
@@ -118,6 +116,10 @@ static struct usb_serial_driver kl5kusb105d_device = {
118 .prepare_write_buffer = klsi_105_prepare_write_buffer, 116 .prepare_write_buffer = klsi_105_prepare_write_buffer,
119}; 117};
120 118
119static struct usb_serial_driver * const serial_drivers[] = {
120 &kl5kusb105d_device, NULL
121};
122
121struct klsi_105_port_settings { 123struct klsi_105_port_settings {
122 __u8 pktlen; /* always 5, it seems */ 124 __u8 pktlen; /* always 5, it seems */
123 __u8 baudrate; 125 __u8 baudrate;
@@ -690,40 +692,11 @@ static int klsi_105_tiocmset(struct tty_struct *tty,
690 return retval; 692 return retval;
691} 693}
692 694
693 695module_usb_serial_driver(kl5kusb105d_driver, serial_drivers);
694static int __init klsi_105_init(void)
695{
696 int retval;
697 retval = usb_serial_register(&kl5kusb105d_device);
698 if (retval)
699 goto failed_usb_serial_register;
700 retval = usb_register(&kl5kusb105d_driver);
701 if (retval)
702 goto failed_usb_register;
703
704 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
705 DRIVER_DESC "\n");
706 return 0;
707failed_usb_register:
708 usb_serial_deregister(&kl5kusb105d_device);
709failed_usb_serial_register:
710 return retval;
711}
712
713static void __exit klsi_105_exit(void)
714{
715 usb_deregister(&kl5kusb105d_driver);
716 usb_serial_deregister(&kl5kusb105d_device);
717}
718
719
720module_init(klsi_105_init);
721module_exit(klsi_105_exit);
722 696
723MODULE_AUTHOR(DRIVER_AUTHOR); 697MODULE_AUTHOR(DRIVER_AUTHOR);
724MODULE_DESCRIPTION(DRIVER_DESC); 698MODULE_DESCRIPTION(DRIVER_DESC);
725MODULE_LICENSE("GPL"); 699MODULE_LICENSE("GPL");
726 700
727
728module_param(debug, bool, S_IRUGO | S_IWUSR); 701module_param(debug, bool, S_IRUGO | S_IWUSR);
729MODULE_PARM_DESC(debug, "enable extensive debugging messages"); 702MODULE_PARM_DESC(debug, "enable extensive debugging messages");
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 5d3beeeb5fd9..4a9a75eb9b95 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -38,7 +38,7 @@
38#include <linux/ioctl.h> 38#include <linux/ioctl.h>
39#include "kobil_sct.h" 39#include "kobil_sct.h"
40 40
41static int debug; 41static bool debug;
42 42
43/* Version Information */ 43/* Version Information */
44#define DRIVER_VERSION "21/05/2004" 44#define DRIVER_VERSION "21/05/2004"
@@ -90,7 +90,6 @@ static struct usb_driver kobil_driver = {
90 .probe = usb_serial_probe, 90 .probe = usb_serial_probe,
91 .disconnect = usb_serial_disconnect, 91 .disconnect = usb_serial_disconnect,
92 .id_table = id_table, 92 .id_table = id_table,
93 .no_dynamic_id = 1,
94}; 93};
95 94
96 95
@@ -100,7 +99,6 @@ static struct usb_serial_driver kobil_device = {
100 .name = "kobil", 99 .name = "kobil",
101 }, 100 },
102 .description = "KOBIL USB smart card terminal", 101 .description = "KOBIL USB smart card terminal",
103 .usb_driver = &kobil_driver,
104 .id_table = id_table, 102 .id_table = id_table,
105 .num_ports = 1, 103 .num_ports = 1,
106 .attach = kobil_startup, 104 .attach = kobil_startup,
@@ -117,6 +115,9 @@ static struct usb_serial_driver kobil_device = {
117 .read_int_callback = kobil_read_int_callback, 115 .read_int_callback = kobil_read_int_callback,
118}; 116};
119 117
118static struct usb_serial_driver * const serial_drivers[] = {
119 &kobil_device, NULL
120};
120 121
121struct kobil_private { 122struct kobil_private {
122 int write_int_endpoint_address; 123 int write_int_endpoint_address;
@@ -682,35 +683,7 @@ static int kobil_ioctl(struct tty_struct *tty,
682 } 683 }
683} 684}
684 685
685static int __init kobil_init(void) 686module_usb_serial_driver(kobil_driver, serial_drivers);
686{
687 int retval;
688 retval = usb_serial_register(&kobil_device);
689 if (retval)
690 goto failed_usb_serial_register;
691 retval = usb_register(&kobil_driver);
692 if (retval)
693 goto failed_usb_register;
694
695 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
696 DRIVER_DESC "\n");
697
698 return 0;
699failed_usb_register:
700 usb_serial_deregister(&kobil_device);
701failed_usb_serial_register:
702 return retval;
703}
704
705
706static void __exit kobil_exit(void)
707{
708 usb_deregister(&kobil_driver);
709 usb_serial_deregister(&kobil_device);
710}
711
712module_init(kobil_init);
713module_exit(kobil_exit);
714 687
715MODULE_AUTHOR(DRIVER_AUTHOR); 688MODULE_AUTHOR(DRIVER_AUTHOR);
716MODULE_DESCRIPTION(DRIVER_DESC); 689MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 27fa9c8a77b0..6edd26130e25 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -88,7 +88,6 @@ static struct usb_driver mct_u232_driver = {
88 .probe = usb_serial_probe, 88 .probe = usb_serial_probe,
89 .disconnect = usb_serial_disconnect, 89 .disconnect = usb_serial_disconnect,
90 .id_table = id_table_combined, 90 .id_table = id_table_combined,
91 .no_dynamic_id = 1,
92}; 91};
93 92
94static struct usb_serial_driver mct_u232_device = { 93static struct usb_serial_driver mct_u232_device = {
@@ -97,7 +96,6 @@ static struct usb_serial_driver mct_u232_device = {
97 .name = "mct_u232", 96 .name = "mct_u232",
98 }, 97 },
99 .description = "MCT U232", 98 .description = "MCT U232",
100 .usb_driver = &mct_u232_driver,
101 .id_table = id_table_combined, 99 .id_table = id_table_combined,
102 .num_ports = 1, 100 .num_ports = 1,
103 .open = mct_u232_open, 101 .open = mct_u232_open,
@@ -116,6 +114,10 @@ static struct usb_serial_driver mct_u232_device = {
116 .get_icount = mct_u232_get_icount, 114 .get_icount = mct_u232_get_icount,
117}; 115};
118 116
117static struct usb_serial_driver * const serial_drivers[] = {
118 &mct_u232_device, NULL
119};
120
119struct mct_u232_private { 121struct mct_u232_private {
120 spinlock_t lock; 122 spinlock_t lock;
121 unsigned int control_state; /* Modem Line Setting (TIOCM) */ 123 unsigned int control_state; /* Modem Line Setting (TIOCM) */
@@ -904,33 +906,7 @@ static int mct_u232_get_icount(struct tty_struct *tty,
904 return 0; 906 return 0;
905} 907}
906 908
907static int __init mct_u232_init(void) 909module_usb_serial_driver(mct_u232_driver, serial_drivers);
908{
909 int retval;
910 retval = usb_serial_register(&mct_u232_device);
911 if (retval)
912 goto failed_usb_serial_register;
913 retval = usb_register(&mct_u232_driver);
914 if (retval)
915 goto failed_usb_register;
916 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
917 DRIVER_DESC "\n");
918 return 0;
919failed_usb_register:
920 usb_serial_deregister(&mct_u232_device);
921failed_usb_serial_register:
922 return retval;
923}
924
925
926static void __exit mct_u232_exit(void)
927{
928 usb_deregister(&mct_u232_driver);
929 usb_serial_deregister(&mct_u232_device);
930}
931
932module_init(mct_u232_init);
933module_exit(mct_u232_exit);
934 910
935MODULE_AUTHOR(DRIVER_AUTHOR); 911MODULE_AUTHOR(DRIVER_AUTHOR);
936MODULE_DESCRIPTION(DRIVER_DESC); 912MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 4554ee49e635..bdce82034122 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1294,7 +1294,7 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
1294 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, 1294 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
1295 GFP_KERNEL); 1295 GFP_KERNEL);
1296 if (urb->transfer_buffer == NULL) { 1296 if (urb->transfer_buffer == NULL) {
1297 dev_err(&port->dev, "%s no more kernel memory...\n", 1297 dev_err_console(port, "%s no more kernel memory...\n",
1298 __func__); 1298 __func__);
1299 goto exit; 1299 goto exit;
1300 } 1300 }
@@ -1315,7 +1315,7 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
1315 /* send it down the pipe */ 1315 /* send it down the pipe */
1316 status = usb_submit_urb(urb, GFP_ATOMIC); 1316 status = usb_submit_urb(urb, GFP_ATOMIC);
1317 if (status) { 1317 if (status) {
1318 dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed " 1318 dev_err_console(port, "%s - usb_submit_urb(write bulk) failed "
1319 "with status = %d\n", __func__, status); 1319 "with status = %d\n", __func__, status);
1320 bytes_sent = status; 1320 bytes_sent = status;
1321 goto exit; 1321 goto exit;
@@ -2169,7 +2169,6 @@ static struct usb_driver usb_driver = {
2169 .probe = usb_serial_probe, 2169 .probe = usb_serial_probe,
2170 .disconnect = usb_serial_disconnect, 2170 .disconnect = usb_serial_disconnect,
2171 .id_table = moschip_port_id_table, 2171 .id_table = moschip_port_id_table,
2172 .no_dynamic_id = 1,
2173}; 2172};
2174 2173
2175static struct usb_serial_driver moschip7720_2port_driver = { 2174static struct usb_serial_driver moschip7720_2port_driver = {
@@ -2178,7 +2177,6 @@ static struct usb_serial_driver moschip7720_2port_driver = {
2178 .name = "moschip7720", 2177 .name = "moschip7720",
2179 }, 2178 },
2180 .description = "Moschip 2 port adapter", 2179 .description = "Moschip 2 port adapter",
2181 .usb_driver = &usb_driver,
2182 .id_table = moschip_port_id_table, 2180 .id_table = moschip_port_id_table,
2183 .calc_num_ports = mos77xx_calc_num_ports, 2181 .calc_num_ports = mos77xx_calc_num_ports,
2184 .open = mos7720_open, 2182 .open = mos7720_open,
@@ -2201,44 +2199,12 @@ static struct usb_serial_driver moschip7720_2port_driver = {
2201 .read_int_callback = NULL /* dynamically assigned in probe() */ 2199 .read_int_callback = NULL /* dynamically assigned in probe() */
2202}; 2200};
2203 2201
2204static int __init moschip7720_init(void) 2202static struct usb_serial_driver * const serial_drivers[] = {
2205{ 2203 &moschip7720_2port_driver, NULL
2206 int retval; 2204};
2207
2208 dbg("%s: Entering ..........", __func__);
2209
2210 /* Register with the usb serial */
2211 retval = usb_serial_register(&moschip7720_2port_driver);
2212 if (retval)
2213 goto failed_port_device_register;
2214
2215 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
2216 DRIVER_DESC "\n");
2217
2218 /* Register with the usb */
2219 retval = usb_register(&usb_driver);
2220 if (retval)
2221 goto failed_usb_register;
2222
2223 return 0;
2224
2225failed_usb_register:
2226 usb_serial_deregister(&moschip7720_2port_driver);
2227
2228failed_port_device_register:
2229 return retval;
2230}
2231
2232static void __exit moschip7720_exit(void)
2233{
2234 usb_deregister(&usb_driver);
2235 usb_serial_deregister(&moschip7720_2port_driver);
2236}
2237 2205
2238module_init(moschip7720_init); 2206module_usb_serial_driver(usb_driver, serial_drivers);
2239module_exit(moschip7720_exit);
2240 2207
2241/* Module information */
2242MODULE_AUTHOR(DRIVER_AUTHOR); 2208MODULE_AUTHOR(DRIVER_AUTHOR);
2243MODULE_DESCRIPTION(DRIVER_DESC); 2209MODULE_DESCRIPTION(DRIVER_DESC);
2244MODULE_LICENSE("GPL"); 2210MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 03b5e249e95e..f7e6e30f53ee 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1509,7 +1509,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
1509 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); 1509 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
1510 1510
1511 if (urb->transfer_buffer == NULL) { 1511 if (urb->transfer_buffer == NULL) {
1512 dev_err(&port->dev, "%s no more kernel memory...\n", 1512 dev_err_console(port, "%s no more kernel memory...\n",
1513 __func__); 1513 __func__);
1514 goto exit; 1514 goto exit;
1515 } 1515 }
@@ -1535,7 +1535,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
1535 1535
1536 if (status) { 1536 if (status) {
1537 mos7840_port->busy[i] = 0; 1537 mos7840_port->busy[i] = 0;
1538 dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed " 1538 dev_err_console(port, "%s - usb_submit_urb(write bulk) failed "
1539 "with status = %d\n", __func__, status); 1539 "with status = %d\n", __func__, status);
1540 bytes_sent = status; 1540 bytes_sent = status;
1541 goto exit; 1541 goto exit;
@@ -2638,7 +2638,6 @@ static struct usb_driver io_driver = {
2638 .probe = usb_serial_probe, 2638 .probe = usb_serial_probe,
2639 .disconnect = usb_serial_disconnect, 2639 .disconnect = usb_serial_disconnect,
2640 .id_table = moschip_id_table_combined, 2640 .id_table = moschip_id_table_combined,
2641 .no_dynamic_id = 1,
2642}; 2641};
2643 2642
2644static struct usb_serial_driver moschip7840_4port_device = { 2643static struct usb_serial_driver moschip7840_4port_device = {
@@ -2647,7 +2646,6 @@ static struct usb_serial_driver moschip7840_4port_device = {
2647 .name = "mos7840", 2646 .name = "mos7840",
2648 }, 2647 },
2649 .description = DRIVER_DESC, 2648 .description = DRIVER_DESC,
2650 .usb_driver = &io_driver,
2651 .id_table = moschip_port_id_table, 2649 .id_table = moschip_port_id_table,
2652 .num_ports = 4, 2650 .num_ports = 4,
2653 .open = mos7840_open, 2651 .open = mos7840_open,
@@ -2674,57 +2672,12 @@ static struct usb_serial_driver moschip7840_4port_device = {
2674 .read_int_callback = mos7840_interrupt_callback, 2672 .read_int_callback = mos7840_interrupt_callback,
2675}; 2673};
2676 2674
2677/**************************************************************************** 2675static struct usb_serial_driver * const serial_drivers[] = {
2678 * moschip7840_init 2676 &moschip7840_4port_device, NULL
2679 * This is called by the module subsystem, or on startup to initialize us 2677};
2680 ****************************************************************************/
2681static int __init moschip7840_init(void)
2682{
2683 int retval;
2684
2685 dbg("%s", " mos7840_init :entering..........");
2686
2687 /* Register with the usb serial */
2688 retval = usb_serial_register(&moschip7840_4port_device);
2689
2690 if (retval)
2691 goto failed_port_device_register;
2692
2693 dbg("%s", "Entering...");
2694 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
2695 DRIVER_DESC "\n");
2696
2697 /* Register with the usb */
2698 retval = usb_register(&io_driver);
2699 if (retval == 0) {
2700 dbg("%s", "Leaving...");
2701 return 0;
2702 }
2703 usb_serial_deregister(&moschip7840_4port_device);
2704failed_port_device_register:
2705 return retval;
2706}
2707
2708/****************************************************************************
2709 * moschip7840_exit
2710 * Called when the driver is about to be unloaded.
2711 ****************************************************************************/
2712static void __exit moschip7840_exit(void)
2713{
2714
2715 dbg("%s", " mos7840_exit :entering..........");
2716
2717 usb_deregister(&io_driver);
2718
2719 usb_serial_deregister(&moschip7840_4port_device);
2720
2721 dbg("%s", "Entering...");
2722}
2723 2678
2724module_init(moschip7840_init); 2679module_usb_serial_driver(io_driver, serial_drivers);
2725module_exit(moschip7840_exit);
2726 2680
2727/* Module information */
2728MODULE_DESCRIPTION(DRIVER_DESC); 2681MODULE_DESCRIPTION(DRIVER_DESC);
2729MODULE_LICENSE("GPL"); 2682MODULE_LICENSE("GPL");
2730 2683
diff --git a/drivers/usb/serial/moto_modem.c b/drivers/usb/serial/moto_modem.c
index e2bfecc46402..3ab6214b4bbf 100644
--- a/drivers/usb/serial/moto_modem.c
+++ b/drivers/usb/serial/moto_modem.c
@@ -36,7 +36,6 @@ static struct usb_driver moto_driver = {
36 .probe = usb_serial_probe, 36 .probe = usb_serial_probe,
37 .disconnect = usb_serial_disconnect, 37 .disconnect = usb_serial_disconnect,
38 .id_table = id_table, 38 .id_table = id_table,
39 .no_dynamic_id = 1,
40}; 39};
41 40
42static struct usb_serial_driver moto_device = { 41static struct usb_serial_driver moto_device = {
@@ -45,29 +44,12 @@ static struct usb_serial_driver moto_device = {
45 .name = "moto-modem", 44 .name = "moto-modem",
46 }, 45 },
47 .id_table = id_table, 46 .id_table = id_table,
48 .usb_driver = &moto_driver,
49 .num_ports = 1, 47 .num_ports = 1,
50}; 48};
51 49
52static int __init moto_init(void) 50static struct usb_serial_driver * const serial_drivers[] = {
53{ 51 &moto_device, NULL
54 int retval; 52};
55
56 retval = usb_serial_register(&moto_device);
57 if (retval)
58 return retval;
59 retval = usb_register(&moto_driver);
60 if (retval)
61 usb_serial_deregister(&moto_device);
62 return retval;
63}
64
65static void __exit moto_exit(void)
66{
67 usb_deregister(&moto_driver);
68 usb_serial_deregister(&moto_device);
69}
70 53
71module_init(moto_init); 54module_usb_serial_driver(moto_driver, serial_drivers);
72module_exit(moto_exit);
73MODULE_LICENSE("GPL"); 55MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c
index b28f1db0195f..29ab6eb5b536 100644
--- a/drivers/usb/serial/navman.c
+++ b/drivers/usb/serial/navman.c
@@ -35,7 +35,6 @@ static struct usb_driver navman_driver = {
35 .probe = usb_serial_probe, 35 .probe = usb_serial_probe,
36 .disconnect = usb_serial_disconnect, 36 .disconnect = usb_serial_disconnect,
37 .id_table = id_table, 37 .id_table = id_table,
38 .no_dynamic_id = 1,
39}; 38};
40 39
41static void navman_read_int_callback(struct urb *urb) 40static void navman_read_int_callback(struct urb *urb)
@@ -122,7 +121,6 @@ static struct usb_serial_driver navman_device = {
122 .name = "navman", 121 .name = "navman",
123 }, 122 },
124 .id_table = id_table, 123 .id_table = id_table,
125 .usb_driver = &navman_driver,
126 .num_ports = 1, 124 .num_ports = 1,
127 .open = navman_open, 125 .open = navman_open,
128 .close = navman_close, 126 .close = navman_close,
@@ -130,27 +128,12 @@ static struct usb_serial_driver navman_device = {
130 .read_int_callback = navman_read_int_callback, 128 .read_int_callback = navman_read_int_callback,
131}; 129};
132 130
133static int __init navman_init(void) 131static struct usb_serial_driver * const serial_drivers[] = {
134{ 132 &navman_device, NULL
135 int retval; 133};
136
137 retval = usb_serial_register(&navman_device);
138 if (retval)
139 return retval;
140 retval = usb_register(&navman_driver);
141 if (retval)
142 usb_serial_deregister(&navman_device);
143 return retval;
144}
145 134
146static void __exit navman_exit(void) 135module_usb_serial_driver(navman_driver, serial_drivers);
147{
148 usb_deregister(&navman_driver);
149 usb_serial_deregister(&navman_device);
150}
151 136
152module_init(navman_init);
153module_exit(navman_exit);
154MODULE_LICENSE("GPL"); 137MODULE_LICENSE("GPL");
155 138
156module_param(debug, bool, S_IRUGO | S_IWUSR); 139module_param(debug, bool, S_IRUGO | S_IWUSR);
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 8b8d58a2ac12..88dc785bb298 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -62,7 +62,6 @@ static struct usb_driver omninet_driver = {
62 .probe = usb_serial_probe, 62 .probe = usb_serial_probe,
63 .disconnect = usb_serial_disconnect, 63 .disconnect = usb_serial_disconnect,
64 .id_table = id_table, 64 .id_table = id_table,
65 .no_dynamic_id = 1,
66}; 65};
67 66
68 67
@@ -72,7 +71,6 @@ static struct usb_serial_driver zyxel_omninet_device = {
72 .name = "omninet", 71 .name = "omninet",
73 }, 72 },
74 .description = "ZyXEL - omni.net lcd plus usb", 73 .description = "ZyXEL - omni.net lcd plus usb",
75 .usb_driver = &omninet_driver,
76 .id_table = id_table, 74 .id_table = id_table,
77 .num_ports = 1, 75 .num_ports = 1,
78 .attach = omninet_attach, 76 .attach = omninet_attach,
@@ -86,6 +84,10 @@ static struct usb_serial_driver zyxel_omninet_device = {
86 .release = omninet_release, 84 .release = omninet_release,
87}; 85};
88 86
87static struct usb_serial_driver * const serial_drivers[] = {
88 &zyxel_omninet_device, NULL
89};
90
89 91
90/* The protocol. 92/* The protocol.
91 * 93 *
@@ -254,7 +256,7 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
254 result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); 256 result = usb_submit_urb(wport->write_urb, GFP_ATOMIC);
255 if (result) { 257 if (result) {
256 set_bit(0, &wport->write_urbs_free); 258 set_bit(0, &wport->write_urbs_free);
257 dev_err(&port->dev, 259 dev_err_console(port,
258 "%s - failed submitting write urb, error %d\n", 260 "%s - failed submitting write urb, error %d\n",
259 __func__, result); 261 __func__, result);
260 } else 262 } else
@@ -319,35 +321,7 @@ static void omninet_release(struct usb_serial *serial)
319 kfree(usb_get_serial_port_data(port)); 321 kfree(usb_get_serial_port_data(port));
320} 322}
321 323
322 324module_usb_serial_driver(omninet_driver, serial_drivers);
323static int __init omninet_init(void)
324{
325 int retval;
326 retval = usb_serial_register(&zyxel_omninet_device);
327 if (retval)
328 goto failed_usb_serial_register;
329 retval = usb_register(&omninet_driver);
330 if (retval)
331 goto failed_usb_register;
332 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
333 DRIVER_DESC "\n");
334 return 0;
335failed_usb_register:
336 usb_serial_deregister(&zyxel_omninet_device);
337failed_usb_serial_register:
338 return retval;
339}
340
341
342static void __exit omninet_exit(void)
343{
344 usb_deregister(&omninet_driver);
345 usb_serial_deregister(&zyxel_omninet_device);
346}
347
348
349module_init(omninet_init);
350module_exit(omninet_exit);
351 325
352MODULE_AUTHOR(DRIVER_AUTHOR); 326MODULE_AUTHOR(DRIVER_AUTHOR);
353MODULE_DESCRIPTION(DRIVER_DESC); 327MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index 262ded9e076b..82cc9d202b83 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -604,7 +604,6 @@ static struct usb_driver opticon_driver = {
604 .suspend = opticon_suspend, 604 .suspend = opticon_suspend,
605 .resume = opticon_resume, 605 .resume = opticon_resume,
606 .id_table = id_table, 606 .id_table = id_table,
607 .no_dynamic_id = 1,
608}; 607};
609 608
610static struct usb_serial_driver opticon_device = { 609static struct usb_serial_driver opticon_device = {
@@ -613,7 +612,6 @@ static struct usb_serial_driver opticon_device = {
613 .name = "opticon", 612 .name = "opticon",
614 }, 613 },
615 .id_table = id_table, 614 .id_table = id_table,
616 .usb_driver = &opticon_driver,
617 .num_ports = 1, 615 .num_ports = 1,
618 .attach = opticon_startup, 616 .attach = opticon_startup,
619 .open = opticon_open, 617 .open = opticon_open,
@@ -629,27 +627,12 @@ static struct usb_serial_driver opticon_device = {
629 .tiocmset = opticon_tiocmset, 627 .tiocmset = opticon_tiocmset,
630}; 628};
631 629
632static int __init opticon_init(void) 630static struct usb_serial_driver * const serial_drivers[] = {
633{ 631 &opticon_device, NULL
634 int retval; 632};
635
636 retval = usb_serial_register(&opticon_device);
637 if (retval)
638 return retval;
639 retval = usb_register(&opticon_driver);
640 if (retval)
641 usb_serial_deregister(&opticon_device);
642 return retval;
643}
644 633
645static void __exit opticon_exit(void) 634module_usb_serial_driver(opticon_driver, serial_drivers);
646{
647 usb_deregister(&opticon_driver);
648 usb_serial_deregister(&opticon_device);
649}
650 635
651module_init(opticon_init);
652module_exit(opticon_exit);
653MODULE_DESCRIPTION(DRIVER_DESC); 636MODULE_DESCRIPTION(DRIVER_DESC);
654MODULE_LICENSE("GPL"); 637MODULE_LICENSE("GPL");
655 638
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 420d9857394a..005511b2ee08 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -480,6 +480,13 @@ static void option_instat_callback(struct urb *urb);
480#define ZD_VENDOR_ID 0x0685 480#define ZD_VENDOR_ID 0x0685
481#define ZD_PRODUCT_7000 0x7000 481#define ZD_PRODUCT_7000 0x7000
482 482
483/* LG products */
484#define LG_VENDOR_ID 0x1004
485#define LG_PRODUCT_L02C 0x618f
486
487/* MediaTek products */
488#define MEDIATEK_VENDOR_ID 0x0e8d
489
483/* some devices interfaces need special handling due to a number of reasons */ 490/* some devices interfaces need special handling due to a number of reasons */
484enum option_blacklist_reason { 491enum option_blacklist_reason {
485 OPTION_BLACKLIST_NONE = 0, 492 OPTION_BLACKLIST_NONE = 0,
@@ -784,7 +791,6 @@ static const struct usb_device_id option_ids[] = {
784 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff), 791 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0012, 0xff, 0xff, 0xff),
785 .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, 792 .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
786 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) }, 793 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0013, 0xff, 0xff, 0xff) },
787 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) },
788 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) }, 794 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628, 0xff, 0xff, 0xff) },
789 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) }, 795 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0016, 0xff, 0xff, 0xff) },
790 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff), 796 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff),
@@ -799,7 +805,6 @@ static const struct usb_device_id option_ids[] = {
799 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) }, 805 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0024, 0xff, 0xff, 0xff) },
800 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff), 806 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0025, 0xff, 0xff, 0xff),
801 .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, 807 .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
802 /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0026, 0xff, 0xff, 0xff) }, */
803 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) }, 808 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0028, 0xff, 0xff, 0xff) },
804 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) }, 809 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0029, 0xff, 0xff, 0xff) },
805 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) }, 810 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0030, 0xff, 0xff, 0xff) },
@@ -824,7 +829,6 @@ static const struct usb_device_id option_ids[] = {
824 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) }, 829 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0051, 0xff, 0xff, 0xff) },
825 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff), 830 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0052, 0xff, 0xff, 0xff),
826 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 831 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
827 /* { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0053, 0xff, 0xff, 0xff) }, */
828 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) }, 832 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0054, 0xff, 0xff, 0xff) },
829 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff), 833 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0055, 0xff, 0xff, 0xff),
830 .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, 834 .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
@@ -832,7 +836,6 @@ static const struct usb_device_id option_ids[] = {
832 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) }, 836 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0057, 0xff, 0xff, 0xff) },
833 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff), 837 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0058, 0xff, 0xff, 0xff),
834 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 838 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
835 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
836 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) }, 839 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0061, 0xff, 0xff, 0xff) },
837 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) }, 840 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0062, 0xff, 0xff, 0xff) },
838 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff), 841 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0063, 0xff, 0xff, 0xff),
@@ -842,7 +845,6 @@ static const struct usb_device_id option_ids[] = {
842 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) }, 845 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0066, 0xff, 0xff, 0xff) },
843 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0067, 0xff, 0xff, 0xff) }, 846 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0067, 0xff, 0xff, 0xff) },
844 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) }, 847 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0069, 0xff, 0xff, 0xff) },
845 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
846 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) }, 848 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0076, 0xff, 0xff, 0xff) },
847 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0077, 0xff, 0xff, 0xff) }, 849 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0077, 0xff, 0xff, 0xff) },
848 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) }, 850 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0078, 0xff, 0xff, 0xff) },
@@ -851,6 +853,16 @@ static const struct usb_device_id option_ids[] = {
851 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) }, 853 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) },
852 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) }, 854 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) },
853 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) }, 855 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) },
856 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0088, 0xff, 0xff, 0xff) },
857 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0089, 0xff, 0xff, 0xff) },
858 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0090, 0xff, 0xff, 0xff) },
859 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0091, 0xff, 0xff, 0xff) },
860 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0092, 0xff, 0xff, 0xff) },
861 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0093, 0xff, 0xff, 0xff) },
862 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) },
863 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0095, 0xff, 0xff, 0xff) },
864 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0096, 0xff, 0xff, 0xff) },
865 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0097, 0xff, 0xff, 0xff) },
854 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff), 866 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff),
855 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 867 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
856 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) }, 868 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) },
@@ -871,23 +883,18 @@ static const struct usb_device_id option_ids[] = {
871 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) }, 883 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) },
872 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0144, 0xff, 0xff, 0xff) }, 884 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0144, 0xff, 0xff, 0xff) },
873 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0145, 0xff, 0xff, 0xff) }, 885 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0145, 0xff, 0xff, 0xff) },
874 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0146, 0xff, 0xff, 0xff) },
875 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) },
876 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0148, 0xff, 0xff, 0xff) }, 886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0148, 0xff, 0xff, 0xff) },
877 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0149, 0xff, 0xff, 0xff) },
878 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0150, 0xff, 0xff, 0xff) },
879 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0151, 0xff, 0xff, 0xff) }, 887 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0151, 0xff, 0xff, 0xff) },
880 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
881 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) }, 888 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) },
882 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0154, 0xff, 0xff, 0xff) },
883 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) }, 889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) },
884 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) }, 890 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) },
885 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) }, 891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) },
886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) }, 892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) },
887 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) }, 893 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) },
888 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0160, 0xff, 0xff, 0xff) },
889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) }, 894 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
890 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) }, 895 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) },
896 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0164, 0xff, 0xff, 0xff) },
897 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) }, 898 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) },
892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) }, 899 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) },
893 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) }, 900 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
@@ -1062,17 +1069,27 @@ static const struct usb_device_id option_ids[] = {
1062 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, 1069 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) },
1063 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, 1070 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) },
1064 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, 1071 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) },
1072 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
1073 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
1074 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
1075
1065 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */ 1076 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */
1066 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0027, 0xff, 0xff, 0xff) }, 1077 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0027, 0xff, 0xff, 0xff) },
1067 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) }, 1078 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
1068 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) }, 1079 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) },
1069 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, 1080 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
1070 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, 1081 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
1082 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) },
1071 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, 1083 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) },
1084 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff) },
1072 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, 1085 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) },
1073 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 1086 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) },
1074 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, 1087 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
1075 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, 1088 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff) },
1089 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) },
1090 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff) },
1091 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff) },
1092
1076 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, 1093 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
1077 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, 1094 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
1078 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, 1095 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
@@ -1183,6 +1200,11 @@ static const struct usb_device_id option_ids[] = {
1183 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) }, 1200 { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) },
1184 { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) }, 1201 { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) },
1185 { USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) }, 1202 { USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) },
1203 { USB_DEVICE(LG_VENDOR_ID, LG_PRODUCT_L02C) }, /* docomo L-02C modem */
1204 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x00, 0x00) },
1205 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) },
1206 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) },
1207 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */
1186 { } /* Terminating entry */ 1208 { } /* Terminating entry */
1187}; 1209};
1188MODULE_DEVICE_TABLE(usb, option_ids); 1210MODULE_DEVICE_TABLE(usb, option_ids);
@@ -1197,7 +1219,6 @@ static struct usb_driver option_driver = {
1197 .supports_autosuspend = 1, 1219 .supports_autosuspend = 1,
1198#endif 1220#endif
1199 .id_table = option_ids, 1221 .id_table = option_ids,
1200 .no_dynamic_id = 1,
1201}; 1222};
1202 1223
1203/* The card has three separate interfaces, which the serial driver 1224/* The card has three separate interfaces, which the serial driver
@@ -1210,7 +1231,6 @@ static struct usb_serial_driver option_1port_device = {
1210 .name = "option1", 1231 .name = "option1",
1211 }, 1232 },
1212 .description = "GSM modem (1-port)", 1233 .description = "GSM modem (1-port)",
1213 .usb_driver = &option_driver,
1214 .id_table = option_ids, 1234 .id_table = option_ids,
1215 .num_ports = 1, 1235 .num_ports = 1,
1216 .probe = option_probe, 1236 .probe = option_probe,
@@ -1234,6 +1254,10 @@ static struct usb_serial_driver option_1port_device = {
1234#endif 1254#endif
1235}; 1255};
1236 1256
1257static struct usb_serial_driver * const serial_drivers[] = {
1258 &option_1port_device, NULL
1259};
1260
1237static bool debug; 1261static bool debug;
1238 1262
1239/* per port private data */ 1263/* per port private data */
@@ -1265,36 +1289,7 @@ struct option_port_private {
1265 unsigned long tx_start_time[N_OUT_URB]; 1289 unsigned long tx_start_time[N_OUT_URB];
1266}; 1290};
1267 1291
1268/* Functions used by new usb-serial code. */ 1292module_usb_serial_driver(option_driver, serial_drivers);
1269static int __init option_init(void)
1270{
1271 int retval;
1272 retval = usb_serial_register(&option_1port_device);
1273 if (retval)
1274 goto failed_1port_device_register;
1275 retval = usb_register(&option_driver);
1276 if (retval)
1277 goto failed_driver_register;
1278
1279 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1280 DRIVER_DESC "\n");
1281
1282 return 0;
1283
1284failed_driver_register:
1285 usb_serial_deregister(&option_1port_device);
1286failed_1port_device_register:
1287 return retval;
1288}
1289
1290static void __exit option_exit(void)
1291{
1292 usb_deregister(&option_driver);
1293 usb_serial_deregister(&option_1port_device);
1294}
1295
1296module_init(option_init);
1297module_exit(option_exit);
1298 1293
1299static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, 1294static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason,
1300 const struct option_blacklist_info *blacklist) 1295 const struct option_blacklist_info *blacklist)
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index e287fd32682c..5fdc33c6a3c0 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -71,7 +71,6 @@ static struct usb_driver oti6858_driver = {
71 .probe = usb_serial_probe, 71 .probe = usb_serial_probe,
72 .disconnect = usb_serial_disconnect, 72 .disconnect = usb_serial_disconnect,
73 .id_table = id_table, 73 .id_table = id_table,
74 .no_dynamic_id = 1,
75}; 74};
76 75
77static bool debug; 76static bool debug;
@@ -157,7 +156,6 @@ static struct usb_serial_driver oti6858_device = {
157 .name = "oti6858", 156 .name = "oti6858",
158 }, 157 },
159 .id_table = id_table, 158 .id_table = id_table,
160 .usb_driver = &oti6858_driver,
161 .num_ports = 1, 159 .num_ports = 1,
162 .open = oti6858_open, 160 .open = oti6858_open,
163 .close = oti6858_close, 161 .close = oti6858_close,
@@ -176,6 +174,10 @@ static struct usb_serial_driver oti6858_device = {
176 .release = oti6858_release, 174 .release = oti6858_release,
177}; 175};
178 176
177static struct usb_serial_driver * const serial_drivers[] = {
178 &oti6858_device, NULL
179};
180
179struct oti6858_private { 181struct oti6858_private {
180 spinlock_t lock; 182 spinlock_t lock;
181 183
@@ -302,7 +304,7 @@ static void send_data(struct work_struct *work)
302 if (count != 0) { 304 if (count != 0) {
303 allow = kmalloc(1, GFP_KERNEL); 305 allow = kmalloc(1, GFP_KERNEL);
304 if (!allow) { 306 if (!allow) {
305 dev_err(&port->dev, "%s(): kmalloc failed\n", 307 dev_err_console(port, "%s(): kmalloc failed\n",
306 __func__); 308 __func__);
307 return; 309 return;
308 } 310 }
@@ -334,7 +336,7 @@ static void send_data(struct work_struct *work)
334 port->write_urb->transfer_buffer_length = count; 336 port->write_urb->transfer_buffer_length = count;
335 result = usb_submit_urb(port->write_urb, GFP_NOIO); 337 result = usb_submit_urb(port->write_urb, GFP_NOIO);
336 if (result != 0) { 338 if (result != 0) {
337 dev_err(&port->dev, "%s(): usb_submit_urb() failed" 339 dev_err_console(port, "%s(): usb_submit_urb() failed"
338 " with error %d\n", __func__, result); 340 " with error %d\n", __func__, result);
339 priv->flags.write_urb_in_use = 0; 341 priv->flags.write_urb_in_use = 0;
340 } 342 }
@@ -938,7 +940,7 @@ static void oti6858_write_bulk_callback(struct urb *urb)
938 port->write_urb->transfer_buffer_length = 1; 940 port->write_urb->transfer_buffer_length = 1;
939 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 941 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
940 if (result) { 942 if (result) {
941 dev_err(&port->dev, "%s(): usb_submit_urb() failed," 943 dev_err_console(port, "%s(): usb_submit_urb() failed,"
942 " error %d\n", __func__, result); 944 " error %d\n", __func__, result);
943 } else { 945 } else {
944 return; 946 return;
@@ -956,29 +958,7 @@ static void oti6858_write_bulk_callback(struct urb *urb)
956 } 958 }
957} 959}
958 960
959/* module description and (de)initialization */ 961module_usb_serial_driver(oti6858_driver, serial_drivers);
960
961static int __init oti6858_init(void)
962{
963 int retval;
964
965 retval = usb_serial_register(&oti6858_device);
966 if (retval == 0) {
967 retval = usb_register(&oti6858_driver);
968 if (retval)
969 usb_serial_deregister(&oti6858_device);
970 }
971 return retval;
972}
973
974static void __exit oti6858_exit(void)
975{
976 usb_deregister(&oti6858_driver);
977 usb_serial_deregister(&oti6858_device);
978}
979
980module_init(oti6858_init);
981module_exit(oti6858_exit);
982 962
983MODULE_DESCRIPTION(OTI6858_DESCRIPTION); 963MODULE_DESCRIPTION(OTI6858_DESCRIPTION);
984MODULE_AUTHOR(OTI6858_AUTHOR); 964MODULE_AUTHOR(OTI6858_AUTHOR);
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 3d8cda57ce7a..ff4a174fa5de 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -104,7 +104,6 @@ static struct usb_driver pl2303_driver = {
104 .id_table = id_table, 104 .id_table = id_table,
105 .suspend = usb_serial_suspend, 105 .suspend = usb_serial_suspend,
106 .resume = usb_serial_resume, 106 .resume = usb_serial_resume,
107 .no_dynamic_id = 1,
108 .supports_autosuspend = 1, 107 .supports_autosuspend = 1,
109}; 108};
110 109
@@ -834,7 +833,6 @@ static struct usb_serial_driver pl2303_device = {
834 .name = "pl2303", 833 .name = "pl2303",
835 }, 834 },
836 .id_table = id_table, 835 .id_table = id_table,
837 .usb_driver = &pl2303_driver,
838 .num_ports = 1, 836 .num_ports = 1,
839 .bulk_in_size = 256, 837 .bulk_in_size = 256,
840 .bulk_out_size = 256, 838 .bulk_out_size = 256,
@@ -853,32 +851,11 @@ static struct usb_serial_driver pl2303_device = {
853 .release = pl2303_release, 851 .release = pl2303_release,
854}; 852};
855 853
856static int __init pl2303_init(void) 854static struct usb_serial_driver * const serial_drivers[] = {
857{ 855 &pl2303_device, NULL
858 int retval; 856};
859
860 retval = usb_serial_register(&pl2303_device);
861 if (retval)
862 goto failed_usb_serial_register;
863 retval = usb_register(&pl2303_driver);
864 if (retval)
865 goto failed_usb_register;
866 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
867 return 0;
868failed_usb_register:
869 usb_serial_deregister(&pl2303_device);
870failed_usb_serial_register:
871 return retval;
872}
873
874static void __exit pl2303_exit(void)
875{
876 usb_deregister(&pl2303_driver);
877 usb_serial_deregister(&pl2303_device);
878}
879 857
880module_init(pl2303_init); 858module_usb_serial_driver(pl2303_driver, serial_drivers);
881module_exit(pl2303_exit);
882 859
883MODULE_DESCRIPTION(DRIVER_DESC); 860MODULE_DESCRIPTION(DRIVER_DESC);
884MODULE_LICENSE("GPL"); 861MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c
index 30b73e68a904..966245680f55 100644
--- a/drivers/usb/serial/qcaux.c
+++ b/drivers/usb/serial/qcaux.c
@@ -36,6 +36,7 @@
36#define UTSTARCOM_PRODUCT_UM175_V1 0x3712 36#define UTSTARCOM_PRODUCT_UM175_V1 0x3712
37#define UTSTARCOM_PRODUCT_UM175_V2 0x3714 37#define UTSTARCOM_PRODUCT_UM175_V2 0x3714
38#define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 38#define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715
39#define PANTECH_PRODUCT_UML190_VZW 0x3716
39#define PANTECH_PRODUCT_UML290_VZW 0x3718 40#define PANTECH_PRODUCT_UML290_VZW 0x3718
40 41
41/* CMOTECH devices */ 42/* CMOTECH devices */
@@ -67,7 +68,11 @@ static struct usb_device_id id_table[] = {
67 { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, 68 { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) },
68 { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, 69 { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) },
69 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, 70 { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) },
70 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, 71 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xff, 0xff) },
72 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xfe, 0xff) },
73 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfd, 0xff) }, /* NMEA */
74 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfe, 0xff) }, /* WMC */
75 { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, /* DIAG */
71 { }, 76 { },
72}; 77};
73MODULE_DEVICE_TABLE(usb, id_table); 78MODULE_DEVICE_TABLE(usb, id_table);
@@ -77,7 +82,6 @@ static struct usb_driver qcaux_driver = {
77 .probe = usb_serial_probe, 82 .probe = usb_serial_probe,
78 .disconnect = usb_serial_disconnect, 83 .disconnect = usb_serial_disconnect,
79 .id_table = id_table, 84 .id_table = id_table,
80 .no_dynamic_id = 1,
81}; 85};
82 86
83static struct usb_serial_driver qcaux_device = { 87static struct usb_serial_driver qcaux_device = {
@@ -86,29 +90,12 @@ static struct usb_serial_driver qcaux_device = {
86 .name = "qcaux", 90 .name = "qcaux",
87 }, 91 },
88 .id_table = id_table, 92 .id_table = id_table,
89 .usb_driver = &qcaux_driver,
90 .num_ports = 1, 93 .num_ports = 1,
91}; 94};
92 95
93static int __init qcaux_init(void) 96static struct usb_serial_driver * const serial_drivers[] = {
94{ 97 &qcaux_device, NULL
95 int retval; 98};
96
97 retval = usb_serial_register(&qcaux_device);
98 if (retval)
99 return retval;
100 retval = usb_register(&qcaux_driver);
101 if (retval)
102 usb_serial_deregister(&qcaux_device);
103 return retval;
104}
105
106static void __exit qcaux_exit(void)
107{
108 usb_deregister(&qcaux_driver);
109 usb_serial_deregister(&qcaux_device);
110}
111 99
112module_init(qcaux_init); 100module_usb_serial_driver(qcaux_driver, serial_drivers);
113module_exit(qcaux_exit);
114MODULE_LICENSE("GPL"); 101MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 1d5deee3be52..0206b10c9e6e 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -24,34 +24,44 @@
24 24
25static bool debug; 25static bool debug;
26 26
27#define DEVICE_G1K(v, p) \
28 USB_DEVICE(v, p), .driver_info = 1
29
27static const struct usb_device_id id_table[] = { 30static const struct usb_device_id id_table[] = {
28 {USB_DEVICE(0x05c6, 0x9211)}, /* Acer Gobi QDL device */ 31 /* Gobi 1000 devices */
29 {USB_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 32 {DEVICE_G1K(0x05c6, 0x9211)}, /* Acer Gobi QDL device */
30 {USB_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ 33 {DEVICE_G1K(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
31 {USB_DEVICE(0x03f0, 0x201d)}, /* HP un2400 Gobi QDL Device */ 34 {DEVICE_G1K(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
32 {USB_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ 35 {DEVICE_G1K(0x03f0, 0x201d)}, /* HP un2400 Gobi QDL Device */
33 {USB_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ 36 {DEVICE_G1K(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
34 {USB_DEVICE(0x04da, 0x250c)}, /* Panasonic Gobi QDL device */ 37 {DEVICE_G1K(0x04da, 0x250c)}, /* Panasonic Gobi QDL device */
35 {USB_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ 38 {DEVICE_G1K(0x413c, 0x8172)}, /* Dell Gobi Modem device */
36 {USB_DEVICE(0x413c, 0x8171)}, /* Dell Gobi QDL device */ 39 {DEVICE_G1K(0x413c, 0x8171)}, /* Dell Gobi QDL device */
37 {USB_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ 40 {DEVICE_G1K(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
38 {USB_DEVICE(0x1410, 0xa008)}, /* Novatel Gobi QDL device */ 41 {DEVICE_G1K(0x1410, 0xa008)}, /* Novatel Gobi QDL device */
39 {USB_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ 42 {DEVICE_G1K(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
40 {USB_DEVICE(0x0b05, 0x1774)}, /* Asus Gobi QDL device */ 43 {DEVICE_G1K(0x0b05, 0x1774)}, /* Asus Gobi QDL device */
41 {USB_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ 44 {DEVICE_G1K(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
42 {USB_DEVICE(0x19d2, 0xfff2)}, /* ONDA Gobi QDL device */ 45 {DEVICE_G1K(0x19d2, 0xfff2)}, /* ONDA Gobi QDL device */
43 {USB_DEVICE(0x1557, 0x0a80)}, /* OQO Gobi QDL device */ 46 {DEVICE_G1K(0x1557, 0x0a80)}, /* OQO Gobi QDL device */
44 {USB_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ 47 {DEVICE_G1K(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
45 {USB_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ 48 {DEVICE_G1K(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
46 {USB_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ 49 {DEVICE_G1K(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
47 {USB_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ 50 {DEVICE_G1K(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
48 {USB_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ 51 {DEVICE_G1K(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
49 {USB_DEVICE(0x05c6, 0x9008)}, /* Generic Gobi QDL device */ 52 {DEVICE_G1K(0x05c6, 0x9008)}, /* Generic Gobi QDL device */
50 {USB_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ 53 {DEVICE_G1K(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
51 {USB_DEVICE(0x05c6, 0x9201)}, /* Generic Gobi QDL device */ 54 {DEVICE_G1K(0x05c6, 0x9201)}, /* Generic Gobi QDL device */
52 {USB_DEVICE(0x05c6, 0x9221)}, /* Generic Gobi QDL device */ 55 {DEVICE_G1K(0x05c6, 0x9221)}, /* Generic Gobi QDL device */
53 {USB_DEVICE(0x05c6, 0x9231)}, /* Generic Gobi QDL device */ 56 {DEVICE_G1K(0x05c6, 0x9231)}, /* Generic Gobi QDL device */
54 {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ 57 {DEVICE_G1K(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */
58
59 /* Gobi 2000 devices */
60 {USB_DEVICE(0x1410, 0xa010)}, /* Novatel Gobi 2000 QDL device */
61 {USB_DEVICE(0x1410, 0xa011)}, /* Novatel Gobi 2000 QDL device */
62 {USB_DEVICE(0x1410, 0xa012)}, /* Novatel Gobi 2000 QDL device */
63 {USB_DEVICE(0x1410, 0xa013)}, /* Novatel Gobi 2000 QDL device */
64 {USB_DEVICE(0x1410, 0xa014)}, /* Novatel Gobi 2000 QDL device */
55 {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */ 65 {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */
56 {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ 66 {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
57 {USB_DEVICE(0x05c6, 0x9208)}, /* Generic Gobi 2000 QDL device */ 67 {USB_DEVICE(0x05c6, 0x9208)}, /* Generic Gobi 2000 QDL device */
@@ -86,7 +96,18 @@ static const struct usb_device_id id_table[] = {
86 {USB_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ 96 {USB_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
87 {USB_DEVICE(0x05c6, 0x9204)}, /* Gobi 2000 QDL device */ 97 {USB_DEVICE(0x05c6, 0x9204)}, /* Gobi 2000 QDL device */
88 {USB_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ 98 {USB_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
99
100 /* Gobi 3000 devices */
101 {USB_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Gobi 3000 QDL */
102 {USB_DEVICE(0x05c6, 0x920c)}, /* Gobi 3000 QDL */
103 {USB_DEVICE(0x05c6, 0x920d)}, /* Gobi 3000 Composite */
104 {USB_DEVICE(0x1410, 0xa020)}, /* Novatel Gobi 3000 QDL */
105 {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */
106 {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */
107 {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */
89 {USB_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ 108 {USB_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
109 {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */
110 {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */
90 { } /* Terminating entry */ 111 { } /* Terminating entry */
91}; 112};
92MODULE_DEVICE_TABLE(usb, id_table); 113MODULE_DEVICE_TABLE(usb, id_table);
@@ -108,8 +129,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
108 int retval = -ENODEV; 129 int retval = -ENODEV;
109 __u8 nintf; 130 __u8 nintf;
110 __u8 ifnum; 131 __u8 ifnum;
132 bool is_gobi1k = id->driver_info ? true : false;
111 133
112 dbg("%s", __func__); 134 dbg("%s", __func__);
135 dbg("Is Gobi 1000 = %d", is_gobi1k);
113 136
114 nintf = serial->dev->actconfig->desc.bNumInterfaces; 137 nintf = serial->dev->actconfig->desc.bNumInterfaces;
115 dbg("Num Interfaces = %d", nintf); 138 dbg("Num Interfaces = %d", nintf);
@@ -123,8 +146,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
123 146
124 spin_lock_init(&data->susp_lock); 147 spin_lock_init(&data->susp_lock);
125 148
126 usb_enable_autosuspend(serial->dev);
127
128 switch (nintf) { 149 switch (nintf) {
129 case 1: 150 case 1:
130 /* QDL mode */ 151 /* QDL mode */
@@ -157,15 +178,25 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
157 178
158 case 3: 179 case 3:
159 case 4: 180 case 4:
160 /* Composite mode */ 181 /* Composite mode; don't bind to the QMI/net interface as that
161 /* ifnum == 0 is a broadband network adapter */ 182 * gets handled by other drivers.
162 if (ifnum == 1) { 183 */
163 /* 184
164 * Diagnostics Monitor (serial line 9600 8N1) 185 /* Gobi 1K USB layout:
165 * Qualcomm DM protocol 186 * 0: serial port (doesn't respond)
166 * use "libqcdm" (ModemManager) for communication 187 * 1: serial port (doesn't respond)
167 */ 188 * 2: AT-capable modem port
168 dbg("Diagnostics Monitor found"); 189 * 3: QMI/net
190 *
191 * Gobi 2K+ USB layout:
192 * 0: QMI/net
193 * 1: DM/DIAG (use libqcdm from ModemManager for communication)
194 * 2: AT-capable modem port
195 * 3: NMEA
196 */
197
198 if (ifnum == 1 && !is_gobi1k) {
199 dbg("Gobi 2K+ DM/DIAG interface found");
169 retval = usb_set_interface(serial->dev, ifnum, 0); 200 retval = usb_set_interface(serial->dev, ifnum, 0);
170 if (retval < 0) { 201 if (retval < 0) {
171 dev_err(&serial->dev->dev, 202 dev_err(&serial->dev->dev,
@@ -184,13 +215,13 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
184 retval = -ENODEV; 215 retval = -ENODEV;
185 kfree(data); 216 kfree(data);
186 } 217 }
187 } else if (ifnum==3) { 218 } else if (ifnum==3 && !is_gobi1k) {
188 /* 219 /*
189 * NMEA (serial line 9600 8N1) 220 * NMEA (serial line 9600 8N1)
190 * # echo "\$GPS_START" > /dev/ttyUSBx 221 * # echo "\$GPS_START" > /dev/ttyUSBx
191 * # echo "\$GPS_STOP" > /dev/ttyUSBx 222 * # echo "\$GPS_STOP" > /dev/ttyUSBx
192 */ 223 */
193 dbg("NMEA GPS interface found"); 224 dbg("Gobi 2K+ NMEA GPS interface found");
194 retval = usb_set_interface(serial->dev, ifnum, 0); 225 retval = usb_set_interface(serial->dev, ifnum, 0);
195 if (retval < 0) { 226 if (retval < 0) {
196 dev_err(&serial->dev->dev, 227 dev_err(&serial->dev->dev,
@@ -234,7 +265,6 @@ static struct usb_serial_driver qcdevice = {
234 }, 265 },
235 .description = "Qualcomm USB modem", 266 .description = "Qualcomm USB modem",
236 .id_table = id_table, 267 .id_table = id_table,
237 .usb_driver = &qcdriver,
238 .num_ports = 1, 268 .num_ports = 1,
239 .probe = qcprobe, 269 .probe = qcprobe,
240 .open = usb_wwan_open, 270 .open = usb_wwan_open,
@@ -251,31 +281,11 @@ static struct usb_serial_driver qcdevice = {
251#endif 281#endif
252}; 282};
253 283
254static int __init qcinit(void) 284static struct usb_serial_driver * const serial_drivers[] = {
255{ 285 &qcdevice, NULL
256 int retval; 286};
257
258 retval = usb_serial_register(&qcdevice);
259 if (retval)
260 return retval;
261
262 retval = usb_register(&qcdriver);
263 if (retval) {
264 usb_serial_deregister(&qcdevice);
265 return retval;
266 }
267
268 return 0;
269}
270
271static void __exit qcexit(void)
272{
273 usb_deregister(&qcdriver);
274 usb_serial_deregister(&qcdevice);
275}
276 287
277module_init(qcinit); 288module_usb_serial_driver(qcdriver, serial_drivers);
278module_exit(qcexit);
279 289
280MODULE_AUTHOR(DRIVER_AUTHOR); 290MODULE_AUTHOR(DRIVER_AUTHOR);
281MODULE_DESCRIPTION(DRIVER_DESC); 291MODULE_DESCRIPTION(DRIVER_DESC);
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..46c0430fd38b 100644
--- a/drivers/usb/serial/siemens_mpi.c
+++ b/drivers/usb/serial/siemens_mpi.c
@@ -42,37 +42,15 @@ 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
49static int __init siemens_usb_mpi_init(void) 48static struct usb_serial_driver * const serial_drivers[] = {
50{ 49 &siemens_usb_mpi_device, NULL
51 int retval; 50};
52
53 retval = usb_serial_register(&siemens_usb_mpi_device);
54 if (retval)
55 goto failed_usb_serial_register;
56 retval = usb_register(&siemens_usb_mpi_driver);
57 if (retval)
58 goto failed_usb_register;
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;
66}
67 51
68static void __exit siemens_usb_mpi_exit(void) 52module_usb_serial_driver(siemens_usb_mpi_driver, serial_drivers);
69{
70 usb_deregister(&siemens_usb_mpi_driver);
71 usb_serial_deregister(&siemens_usb_mpi_device);
72}
73 53
74module_init(siemens_usb_mpi_init);
75module_exit(siemens_usb_mpi_exit);
76MODULE_AUTHOR(DRIVER_AUTHOR); 54MODULE_AUTHOR(DRIVER_AUTHOR);
77MODULE_DESCRIPTION(DRIVER_DESC); 55MODULE_DESCRIPTION(DRIVER_DESC);
78MODULE_LICENSE("GPL"); 56MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index fdae0a4407cb..f14465a83dd1 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,38 +1111,11 @@ 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
1116/* Functions used by new usb-serial code. */ 1114static struct usb_serial_driver * const serial_drivers[] = {
1117static int __init sierra_init(void) 1115 &sierra_device, NULL
1118{ 1116};
1119 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
1134failed_driver_register:
1135 usb_serial_deregister(&sierra_device);
1136failed_device_register:
1137 return retval;
1138}
1139
1140static void __exit sierra_exit(void)
1141{
1142 usb_deregister(&sierra_driver);
1143 usb_serial_deregister(&sierra_device);
1144}
1145 1117
1146module_init(sierra_init); 1118module_usb_serial_driver(sierra_driver, serial_drivers);
1147module_exit(sierra_exit);
1148 1119
1149MODULE_AUTHOR(DRIVER_AUTHOR); 1120MODULE_AUTHOR(DRIVER_AUTHOR);
1150MODULE_DESCRIPTION(DRIVER_DESC); 1121MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index d7f5eee18f00..f06c9a8f3d37 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,32 +662,11 @@ 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
667static int __init spcp8x5_init(void) 665static struct usb_serial_driver * const serial_drivers[] = {
668{ 666 &spcp8x5_device, NULL
669 int retval; 667};
670 retval = usb_serial_register(&spcp8x5_device);
671 if (retval)
672 goto failed_usb_serial_register;
673 retval = usb_register(&spcp8x5_driver);
674 if (retval)
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;
683}
684
685static void __exit spcp8x5_exit(void)
686{
687 usb_deregister(&spcp8x5_driver);
688 usb_serial_deregister(&spcp8x5_device);
689}
690 668
691module_init(spcp8x5_init); 669module_usb_serial_driver(spcp8x5_driver, serial_drivers);
692module_exit(spcp8x5_exit);
693 670
694MODULE_DESCRIPTION(DRIVER_DESC); 671MODULE_DESCRIPTION(DRIVER_DESC);
695MODULE_VERSION(DRIVER_VERSION); 672MODULE_VERSION(DRIVER_VERSION);
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
index 7697858d8858..3cdc8a52de44 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,41 +691,11 @@ static struct usb_serial_driver ssu100_device = {
693 .disconnect = usb_serial_generic_disconnect, 691 .disconnect = usb_serial_generic_disconnect,
694}; 692};
695 693
696static int __init ssu100_init(void) 694static struct usb_serial_driver * const serial_drivers[] = {
697{ 695 &ssu100_device, NULL
698 int retval; 696};
699
700 dbg("%s", __func__);
701
702 /* register with usb-serial */
703 retval = usb_serial_register(&ssu100_device);
704
705 if (retval)
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;
721}
722
723static void __exit ssu100_exit(void)
724{
725 usb_deregister(&ssu100_driver);
726 usb_serial_deregister(&ssu100_device);
727}
728 697
729module_init(ssu100_init); 698module_usb_serial_driver(ssu100_driver, serial_drivers);
730module_exit(ssu100_exit);
731 699
732MODULE_DESCRIPTION(DRIVER_DESC); 700MODULE_DESCRIPTION(DRIVER_DESC);
733MODULE_LICENSE("GPL"); 701MODULE_LICENSE("GPL");
diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
index 50651cf4fc61..1a5be136e6cf 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,27 +305,12 @@ static struct usb_serial_driver symbol_device = {
307 .unthrottle = symbol_unthrottle, 305 .unthrottle = symbol_unthrottle,
308}; 306};
309 307
310static int __init symbol_init(void) 308static struct usb_serial_driver * const serial_drivers[] = {
311{ 309 &symbol_device, NULL
312 int retval; 310};
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}
322 311
323static void __exit symbol_exit(void) 312module_usb_serial_driver(symbol_driver, serial_drivers);
324{
325 usb_deregister(&symbol_driver);
326 usb_serial_deregister(&symbol_device);
327}
328 313
329module_init(symbol_init);
330module_exit(symbol_exit);
331MODULE_LICENSE("GPL"); 314MODULE_LICENSE("GPL");
332 315
333module_param(debug, bool, S_IRUGO | S_IWUSR); 316module_param(debug, bool, S_IRUGO | S_IWUSR);
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 8468eb769a29..ab74123d658e 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -165,7 +165,7 @@ static unsigned int product_5052_count;
165/* the array dimension is the number of default entries plus */ 165/* the array dimension is the number of default entries plus */
166/* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */ 166/* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
167/* null entry */ 167/* null entry */
168static struct usb_device_id ti_id_table_3410[13+TI_EXTRA_VID_PID_COUNT+1] = { 168static struct usb_device_id ti_id_table_3410[14+TI_EXTRA_VID_PID_COUNT+1] = {
169 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, 169 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
170 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, 170 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
171 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, 171 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -179,6 +179,7 @@ static struct usb_device_id ti_id_table_3410[13+TI_EXTRA_VID_PID_COUNT+1] = {
179 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, 179 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
180 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, 180 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
181 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, 181 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
182 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
182}; 183};
183 184
184static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = { 185static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
@@ -188,7 +189,7 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
188 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, 189 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
189}; 190};
190 191
191static struct usb_device_id ti_id_table_combined[17+2*TI_EXTRA_VID_PID_COUNT+1] = { 192static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1] = {
192 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, 193 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
193 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, 194 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
194 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, 195 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -206,6 +207,7 @@ static struct usb_device_id ti_id_table_combined[17+2*TI_EXTRA_VID_PID_COUNT+1]
206 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, 207 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
207 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, 208 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
208 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, 209 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
210 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
209 { } 211 { }
210}; 212};
211 213
@@ -214,7 +216,6 @@ static struct usb_driver ti_usb_driver = {
214 .probe = usb_serial_probe, 216 .probe = usb_serial_probe,
215 .disconnect = usb_serial_disconnect, 217 .disconnect = usb_serial_disconnect,
216 .id_table = ti_id_table_combined, 218 .id_table = ti_id_table_combined,
217 .no_dynamic_id = 1,
218}; 219};
219 220
220static struct usb_serial_driver ti_1port_device = { 221static struct usb_serial_driver ti_1port_device = {
@@ -223,7 +224,6 @@ static struct usb_serial_driver ti_1port_device = {
223 .name = "ti_usb_3410_5052_1", 224 .name = "ti_usb_3410_5052_1",
224 }, 225 },
225 .description = "TI USB 3410 1 port adapter", 226 .description = "TI USB 3410 1 port adapter",
226 .usb_driver = &ti_usb_driver,
227 .id_table = ti_id_table_3410, 227 .id_table = ti_id_table_3410,
228 .num_ports = 1, 228 .num_ports = 1,
229 .attach = ti_startup, 229 .attach = ti_startup,
@@ -252,7 +252,6 @@ static struct usb_serial_driver ti_2port_device = {
252 .name = "ti_usb_3410_5052_2", 252 .name = "ti_usb_3410_5052_2",
253 }, 253 },
254 .description = "TI USB 5052 2 port adapter", 254 .description = "TI USB 5052 2 port adapter",
255 .usb_driver = &ti_usb_driver,
256 .id_table = ti_id_table_5052, 255 .id_table = ti_id_table_5052,
257 .num_ports = 2, 256 .num_ports = 2,
258 .attach = ti_startup, 257 .attach = ti_startup,
@@ -275,6 +274,9 @@ static struct usb_serial_driver ti_2port_device = {
275 .write_bulk_callback = ti_bulk_out_callback, 274 .write_bulk_callback = ti_bulk_out_callback,
276}; 275};
277 276
277static struct usb_serial_driver * const serial_drivers[] = {
278 &ti_1port_device, &ti_2port_device, NULL
279};
278 280
279/* Module */ 281/* Module */
280 282
@@ -342,36 +344,17 @@ static int __init ti_init(void)
342 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;
343 } 345 }
344 346
345 ret = usb_serial_register(&ti_1port_device); 347 ret = usb_serial_register_drivers(&ti_usb_driver, serial_drivers);
346 if (ret) 348 if (ret == 0)
347 goto failed_1port; 349 printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
348 ret = usb_serial_register(&ti_2port_device); 350 TI_DRIVER_DESC "\n");
349 if (ret)
350 goto failed_2port;
351
352 ret = usb_register(&ti_usb_driver);
353 if (ret)
354 goto failed_usb;
355
356 printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
357 TI_DRIVER_DESC "\n");
358
359 return 0;
360
361failed_usb:
362 usb_serial_deregister(&ti_2port_device);
363failed_2port:
364 usb_serial_deregister(&ti_1port_device);
365failed_1port:
366 return ret; 351 return ret;
367} 352}
368 353
369 354
370static void __exit ti_exit(void) 355static void __exit ti_exit(void)
371{ 356{
372 usb_deregister(&ti_usb_driver); 357 usb_serial_deregister_drivers(&ti_usb_driver, serial_drivers);
373 usb_serial_deregister(&ti_1port_device);
374 usb_serial_deregister(&ti_2port_device);
375} 358}
376 359
377 360
@@ -1248,7 +1231,6 @@ static void ti_bulk_out_callback(struct urb *urb)
1248{ 1231{
1249 struct ti_port *tport = urb->context; 1232 struct ti_port *tport = urb->context;
1250 struct usb_serial_port *port = tport->tp_port; 1233 struct usb_serial_port *port = tport->tp_port;
1251 struct device *dev = &urb->dev->dev;
1252 int status = urb->status; 1234 int status = urb->status;
1253 1235
1254 dbg("%s - port %d", __func__, port->number); 1236 dbg("%s - port %d", __func__, port->number);
@@ -1266,7 +1248,7 @@ static void ti_bulk_out_callback(struct urb *urb)
1266 wake_up_interruptible(&tport->tp_write_wait); 1248 wake_up_interruptible(&tport->tp_write_wait);
1267 return; 1249 return;
1268 default: 1250 default:
1269 dev_err(dev, "%s - nonzero urb status, %d\n", 1251 dev_err_console(port, "%s - nonzero urb status, %d\n",
1270 __func__, status); 1252 __func__, status);
1271 tport->tp_tdev->td_urb_error = 1; 1253 tport->tp_tdev->td_urb_error = 1;
1272 wake_up_interruptible(&tport->tp_write_wait); 1254 wake_up_interruptible(&tport->tp_write_wait);
@@ -1335,7 +1317,7 @@ static void ti_send(struct ti_port *tport)
1335 1317
1336 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 1318 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
1337 if (result) { 1319 if (result) {
1338 dev_err(&port->dev, "%s - submit write urb failed, %d\n", 1320 dev_err_console(port, "%s - submit write urb failed, %d\n",
1339 __func__, result); 1321 __func__, result);
1340 tport->tp_write_urb_in_use = 0; 1322 tport->tp_write_urb_in_use = 0;
1341 /* TODO: reschedule ti_send */ 1323 /* TODO: reschedule ti_send */
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
index 2aac1953993b..f140f1b9d5c0 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -49,6 +49,10 @@
49#define MTS_MT9234ZBA_PRODUCT_ID 0xF115 49#define MTS_MT9234ZBA_PRODUCT_ID 0xF115
50#define MTS_MT9234ZBAOLD_PRODUCT_ID 0x0319 50#define MTS_MT9234ZBAOLD_PRODUCT_ID 0x0319
51 51
52/* Abbott Diabetics vendor and product ids */
53#define ABBOTT_VENDOR_ID 0x1a61
54#define ABBOTT_PRODUCT_ID 0x3410
55
52/* Commands */ 56/* Commands */
53#define TI_GET_VERSION 0x01 57#define TI_GET_VERSION 0x01
54#define TI_GET_PORT_STATUS 0x02 58#define TI_GET_PORT_STATUS 0x02
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 611b206591cb..63ba47dbcc71 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1338,7 +1338,7 @@ static void fixup_generic(struct usb_serial_driver *device)
1338 set_to_generic_if_null(device, prepare_write_buffer); 1338 set_to_generic_if_null(device, prepare_write_buffer);
1339} 1339}
1340 1340
1341int usb_serial_register(struct usb_serial_driver *driver) 1341static int usb_serial_register(struct usb_serial_driver *driver)
1342{ 1342{
1343 int retval; 1343 int retval;
1344 1344
@@ -1372,10 +1372,8 @@ int usb_serial_register(struct usb_serial_driver *driver)
1372 mutex_unlock(&table_lock); 1372 mutex_unlock(&table_lock);
1373 return retval; 1373 return retval;
1374} 1374}
1375EXPORT_SYMBOL_GPL(usb_serial_register);
1376 1375
1377 1376static void usb_serial_deregister(struct usb_serial_driver *device)
1378void usb_serial_deregister(struct usb_serial_driver *device)
1379{ 1377{
1380 printk(KERN_INFO "USB Serial deregistering driver %s\n", 1378 printk(KERN_INFO "USB Serial deregistering driver %s\n",
1381 device->description); 1379 device->description);
@@ -1384,7 +1382,76 @@ void usb_serial_deregister(struct usb_serial_driver *device)
1384 usb_serial_bus_deregister(device); 1382 usb_serial_bus_deregister(device);
1385 mutex_unlock(&table_lock); 1383 mutex_unlock(&table_lock);
1386} 1384}
1387EXPORT_SYMBOL_GPL(usb_serial_deregister); 1385
1386/**
1387 * usb_serial_register_drivers - register drivers for a usb-serial module
1388 * @udriver: usb_driver used for matching devices/interfaces
1389 * @serial_drivers: NULL-terminated array of pointers to drivers to be registered
1390 *
1391 * Registers @udriver and all the drivers in the @serial_drivers array.
1392 * Automatically fills in the .no_dynamic_id field in @udriver and
1393 * the .usb_driver field in each serial driver.
1394 */
1395int usb_serial_register_drivers(struct usb_driver *udriver,
1396 struct usb_serial_driver * const serial_drivers[])
1397{
1398 int rc;
1399 const struct usb_device_id *saved_id_table;
1400 struct usb_serial_driver * const *sd;
1401
1402 /*
1403 * udriver must be registered before any of the serial drivers,
1404 * because the store_new_id() routine for the serial drivers (in
1405 * bus.c) probes udriver.
1406 *
1407 * Performance hack: We don't want udriver to be probed until
1408 * the serial drivers are registered, because the probe would
1409 * simply fail for lack of a matching serial driver.
1410 * Therefore save off udriver's id_table until we are all set.
1411 */
1412 saved_id_table = udriver->id_table;
1413 udriver->id_table = NULL;
1414
1415 udriver->no_dynamic_id = 1;
1416 rc = usb_register(udriver);
1417 if (rc)
1418 return rc;
1419
1420 for (sd = serial_drivers; *sd; ++sd) {
1421 (*sd)->usb_driver = udriver;
1422 rc = usb_serial_register(*sd);
1423 if (rc)
1424 goto failed;
1425 }
1426
1427 /* Now restore udriver's id_table and look for matches */
1428 udriver->id_table = saved_id_table;
1429 rc = driver_attach(&udriver->drvwrap.driver);
1430 return 0;
1431
1432 failed:
1433 while (sd-- > serial_drivers)
1434 usb_serial_deregister(*sd);
1435 usb_deregister(udriver);
1436 return rc;
1437}
1438EXPORT_SYMBOL_GPL(usb_serial_register_drivers);
1439
1440/**
1441 * usb_serial_deregister_drivers - deregister drivers for a usb-serial module
1442 * @udriver: usb_driver to unregister
1443 * @serial_drivers: NULL-terminated array of pointers to drivers to be deregistered
1444 *
1445 * Deregisters @udriver and all the drivers in the @serial_drivers array.
1446 */
1447void usb_serial_deregister_drivers(struct usb_driver *udriver,
1448 struct usb_serial_driver * const serial_drivers[])
1449{
1450 for (; *serial_drivers; ++serial_drivers)
1451 usb_serial_deregister(*serial_drivers);
1452 usb_deregister(udriver);
1453}
1454EXPORT_SYMBOL_GPL(usb_serial_deregister_drivers);
1388 1455
1389/* Module information */ 1456/* Module information */
1390MODULE_AUTHOR(DRIVER_AUTHOR); 1457MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c
index 9b632e753210..e3e8995a4739 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,32 +73,15 @@ 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
84static int __init debug_init(void) 82static struct usb_serial_driver * const serial_drivers[] = {
85{ 83 &debug_device, NULL
86 int retval; 84};
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}
96
97static void __exit debug_exit(void)
98{
99 usb_deregister(&debug_driver);
100 usb_serial_deregister(&debug_device);
101}
102 85
103module_init(debug_init); 86module_usb_serial_driver(debug_driver, serial_drivers);
104module_exit(debug_exit);
105MODULE_LICENSE("GPL"); 87MODULE_LICENSE("GPL");
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..078f338b5feb 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,36 +38,14 @@ 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
46static int __init vivopay_serial_init(void) 44static struct usb_serial_driver * const serial_drivers[] = {
47{ 45 &vivopay_serial_device, NULL
48 int retval; 46};
49 retval = usb_serial_register(&vivopay_serial_device);
50 if (retval)
51 goto failed_usb_serial_register;
52 retval = usb_register(&vivopay_serial_driver);
53 if (retval)
54 goto failed_usb_register;
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;
62}
63
64static void __exit vivopay_serial_exit(void)
65{
66 usb_deregister(&vivopay_serial_driver);
67 usb_serial_deregister(&vivopay_serial_device);
68}
69 47
70module_init(vivopay_serial_init); 48module_usb_serial_driver(vivopay_serial_driver, serial_drivers);
71module_exit(vivopay_serial_exit);
72 49
73MODULE_AUTHOR("Forest Bond <forest.bond@outpostembedded.com>"); 50MODULE_AUTHOR("Forest Bond <forest.bond@outpostembedded.com>");
74MODULE_DESCRIPTION(DRIVER_DESC); 51MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 7e0acf5c8e38..407e23c87946 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;
@@ -740,7 +740,7 @@ static int whiteheat_write(struct tty_struct *tty,
740 urb->transfer_buffer_length = bytes; 740 urb->transfer_buffer_length = bytes;
741 result = usb_submit_urb(urb, GFP_ATOMIC); 741 result = usb_submit_urb(urb, GFP_ATOMIC);
742 if (result) { 742 if (result) {
743 dev_err(&port->dev, 743 dev_err_console(port,
744 "%s - failed submitting write urb, error %d\n", 744 "%s - failed submitting write urb, error %d\n",
745 __func__, result); 745 __func__, result);
746 sent = result; 746 sent = result;
@@ -1454,44 +1454,7 @@ out:
1454 tty_kref_put(tty); 1454 tty_kref_put(tty);
1455} 1455}
1456 1456
1457 1457module_usb_serial_driver(whiteheat_driver, serial_drivers);
1458/*****************************************************************************
1459 * Connect Tech's White Heat module functions
1460 *****************************************************************************/
1461static int __init whiteheat_init(void)
1462{
1463 int retval;
1464 retval = usb_serial_register(&whiteheat_fake_device);
1465 if (retval)
1466 goto failed_fake_register;
1467 retval = usb_serial_register(&whiteheat_device);
1468 if (retval)
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;
1482}
1483
1484
1485static void __exit whiteheat_exit(void)
1486{
1487 usb_deregister(&whiteheat_driver);
1488 usb_serial_deregister(&whiteheat_fake_device);
1489 usb_serial_deregister(&whiteheat_device);
1490}
1491
1492
1493module_init(whiteheat_init);
1494module_exit(whiteheat_exit);
1495 1458
1496MODULE_AUTHOR(DRIVER_AUTHOR); 1459MODULE_AUTHOR(DRIVER_AUTHOR);
1497MODULE_DESCRIPTION(DRIVER_DESC); 1460MODULE_DESCRIPTION(DRIVER_DESC);
diff --git a/drivers/usb/serial/zio.c b/drivers/usb/serial/zio.c
index f57967278833..9d0bb3752cd4 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,29 +35,12 @@ 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
43static int __init zio_init(void) 41static struct usb_serial_driver * const serial_drivers[] = {
44{ 42 &zio_device, NULL
45 int retval; 43};
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}
55
56static void __exit zio_exit(void)
57{
58 usb_deregister(&zio_driver);
59 usb_serial_deregister(&zio_device);
60}
61 44
62module_init(zio_init); 45module_usb_serial_driver(zio_driver, serial_drivers);
63module_exit(zio_exit);
64MODULE_LICENSE("GPL"); 46MODULE_LICENSE("GPL");