aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/aircable.c21
-rw-r--r--drivers/usb/serial/airprime.c4
-rw-r--r--drivers/usb/serial/ark3116.c6
-rw-r--r--drivers/usb/serial/belkin_sa.c5
-rw-r--r--drivers/usb/serial/bus.c45
-rw-r--r--drivers/usb/serial/console.c2
-rw-r--r--drivers/usb/serial/cp2101.c14
-rw-r--r--drivers/usb/serial/cyberjack.c3
-rw-r--r--drivers/usb/serial/cypress_m8.c30
-rw-r--r--drivers/usb/serial/digi_acceleport.c12
-rw-r--r--drivers/usb/serial/empeg.c5
-rw-r--r--drivers/usb/serial/ftdi_sio.c7
-rw-r--r--drivers/usb/serial/ftdi_sio.h6
-rw-r--r--drivers/usb/serial/funsoft.c28
-rw-r--r--drivers/usb/serial/garmin_gps.c1
-rw-r--r--drivers/usb/serial/generic.c35
-rw-r--r--drivers/usb/serial/hp4x.c1
-rw-r--r--drivers/usb/serial/io_edgeport.c425
-rw-r--r--drivers/usb/serial/io_edgeport.h6
-rw-r--r--drivers/usb/serial/io_tables.h61
-rw-r--r--drivers/usb/serial/io_ti.c10
-rw-r--r--drivers/usb/serial/io_usbvend.h5
-rw-r--r--drivers/usb/serial/ipaq.c3
-rw-r--r--drivers/usb/serial/ipw.c1
-rw-r--r--drivers/usb/serial/ir-usb.c5
-rw-r--r--drivers/usb/serial/keyspan.c51
-rw-r--r--drivers/usb/serial/keyspan.h9
-rw-r--r--drivers/usb/serial/keyspan_pda.c5
-rw-r--r--drivers/usb/serial/kl5kusb105.c75
-rw-r--r--drivers/usb/serial/kobil_sct.c15
-rw-r--r--drivers/usb/serial/mct_u232.c5
-rw-r--r--drivers/usb/serial/mos7720.c20
-rw-r--r--drivers/usb/serial/mos7840.c26
-rw-r--r--drivers/usb/serial/navman.c1
-rw-r--r--drivers/usb/serial/omninet.c1
-rw-r--r--drivers/usb/serial/option.c14
-rw-r--r--drivers/usb/serial/pl2303.c7
-rw-r--r--drivers/usb/serial/safe_serial.c1
-rw-r--r--drivers/usb/serial/sierra.c31
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c8
-rw-r--r--drivers/usb/serial/usb-serial.c104
-rw-r--r--drivers/usb/serial/visor.c10
-rw-r--r--drivers/usb/serial/visor.h1
-rw-r--r--drivers/usb/serial/whiteheat.c12
44 files changed, 800 insertions, 337 deletions
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 86bcf63b6ba5..11dad42c3c60 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -572,8 +572,20 @@ static void aircable_unthrottle(struct usb_serial_port *port)
572 schedule_work(&priv->rx_work); 572 schedule_work(&priv->rx_work);
573} 573}
574 574
575static struct usb_driver aircable_driver = {
576 .name = "aircable",
577 .probe = usb_serial_probe,
578 .disconnect = usb_serial_disconnect,
579 .id_table = id_table,
580 .no_dynamic_id = 1,
581};
582
575static struct usb_serial_driver aircable_device = { 583static struct usb_serial_driver aircable_device = {
576 .description = "aircable", 584 .driver = {
585 .owner = THIS_MODULE,
586 .name = "aircable",
587 },
588 .usb_driver = &aircable_driver,
577 .id_table = id_table, 589 .id_table = id_table,
578 .num_ports = 1, 590 .num_ports = 1,
579 .attach = aircable_attach, 591 .attach = aircable_attach,
@@ -587,13 +599,6 @@ static struct usb_serial_driver aircable_device = {
587 .unthrottle = aircable_unthrottle, 599 .unthrottle = aircable_unthrottle,
588}; 600};
589 601
590static struct usb_driver aircable_driver = {
591 .name = "aircable",
592 .probe = usb_serial_probe,
593 .disconnect = usb_serial_disconnect,
594 .id_table = id_table,
595};
596
597static int __init aircable_init (void) 602static int __init aircable_init (void)
598{ 603{
599 int retval; 604 int retval;
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index 96c73726d74a..0af42e32fa0a 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -19,8 +19,11 @@
19static struct usb_device_id id_table [] = { 19static struct usb_device_id id_table [] = {
20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ 20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
21 { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ 21 { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */
22 { USB_DEVICE(0x1410, 0x1130) }, /* Novatel Wireless S720 CDMA/EV-DO */
23 { USB_DEVICE(0x1410, 0x2110) }, /* Novatel Wireless U720 CDMA/EV-DO */
22 { USB_DEVICE(0x1410, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */ 24 { USB_DEVICE(0x1410, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */
23 { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */ 25 { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */
26 { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */
24 { }, 27 { },
25}; 28};
26MODULE_DEVICE_TABLE(usb, id_table); 29MODULE_DEVICE_TABLE(usb, id_table);
@@ -274,6 +277,7 @@ static struct usb_serial_driver airprime_device = {
274 .owner = THIS_MODULE, 277 .owner = THIS_MODULE,
275 .name = "airprime", 278 .name = "airprime",
276 }, 279 },
280 .usb_driver = &airprime_driver,
277 .id_table = id_table, 281 .id_table = id_table,
278 .num_interrupt_in = NUM_DONT_CARE, 282 .num_interrupt_in = NUM_DONT_CARE,
279 .num_bulk_in = NUM_DONT_CARE, 283 .num_bulk_in = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 863966c1c5ac..edd685791a6b 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -156,7 +156,7 @@ cleanup:
156} 156}
157 157
158static void ark3116_set_termios(struct usb_serial_port *port, 158static void ark3116_set_termios(struct usb_serial_port *port,
159 struct termios *old_termios) 159 struct ktermios *old_termios)
160{ 160{
161 struct usb_serial *serial = port->serial; 161 struct usb_serial *serial = port->serial;
162 struct ark3116_private *priv = usb_get_serial_port_data(port); 162 struct ark3116_private *priv = usb_get_serial_port_data(port);
@@ -326,7 +326,7 @@ static void ark3116_set_termios(struct usb_serial_port *port,
326 326
327static int ark3116_open(struct usb_serial_port *port, struct file *filp) 327static int ark3116_open(struct usb_serial_port *port, struct file *filp)
328{ 328{
329 struct termios tmp_termios; 329 struct ktermios tmp_termios;
330 struct usb_serial *serial = port->serial; 330 struct usb_serial *serial = port->serial;
331 char *buf; 331 char *buf;
332 int result = 0; 332 int result = 0;
@@ -444,6 +444,7 @@ static struct usb_driver ark3116_driver = {
444 .probe = usb_serial_probe, 444 .probe = usb_serial_probe,
445 .disconnect = usb_serial_disconnect, 445 .disconnect = usb_serial_disconnect,
446 .id_table = id_table, 446 .id_table = id_table,
447 .no_dynamic_id = 1,
447}; 448};
448 449
449static struct usb_serial_driver ark3116_device = { 450static struct usb_serial_driver ark3116_device = {
@@ -452,6 +453,7 @@ static struct usb_serial_driver ark3116_device = {
452 .name = "ark3116", 453 .name = "ark3116",
453 }, 454 },
454 .id_table = id_table, 455 .id_table = id_table,
456 .usb_driver = &ark3116_driver,
455 .num_interrupt_in = 1, 457 .num_interrupt_in = 1,
456 .num_bulk_in = 1, 458 .num_bulk_in = 1,
457 .num_bulk_out = 1, 459 .num_bulk_out = 1,
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 8835bb58ca9b..3b800d277c4b 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -92,7 +92,7 @@ static void belkin_sa_shutdown (struct usb_serial *serial);
92static int belkin_sa_open (struct usb_serial_port *port, struct file *filp); 92static int belkin_sa_open (struct usb_serial_port *port, struct file *filp);
93static void belkin_sa_close (struct usb_serial_port *port, struct file *filp); 93static void belkin_sa_close (struct usb_serial_port *port, struct file *filp);
94static void belkin_sa_read_int_callback (struct urb *urb); 94static void belkin_sa_read_int_callback (struct urb *urb);
95static void belkin_sa_set_termios (struct usb_serial_port *port, struct termios * old); 95static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios * old);
96static int belkin_sa_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); 96static int belkin_sa_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
97static void belkin_sa_break_ctl (struct usb_serial_port *port, int break_state ); 97static void belkin_sa_break_ctl (struct usb_serial_port *port, int break_state );
98static int belkin_sa_tiocmget (struct usb_serial_port *port, struct file *file); 98static int belkin_sa_tiocmget (struct usb_serial_port *port, struct file *file);
@@ -126,6 +126,7 @@ static struct usb_serial_driver belkin_device = {
126 .name = "belkin", 126 .name = "belkin",
127 }, 127 },
128 .description = "Belkin / Peracom / GoHubs USB Serial Adapter", 128 .description = "Belkin / Peracom / GoHubs USB Serial Adapter",
129 .usb_driver = &belkin_driver,
129 .id_table = id_table_combined, 130 .id_table = id_table_combined,
130 .num_interrupt_in = 1, 131 .num_interrupt_in = 1,
131 .num_bulk_in = 1, 132 .num_bulk_in = 1,
@@ -333,7 +334,7 @@ exit:
333 __FUNCTION__, retval); 334 __FUNCTION__, retval);
334} 335}
335 336
336static void belkin_sa_set_termios (struct usb_serial_port *port, struct termios *old_termios) 337static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
337{ 338{
338 struct usb_serial *serial = port->serial; 339 struct usb_serial *serial = port->serial;
339 struct belkin_sa_private *priv = usb_get_serial_port_data(port); 340 struct belkin_sa_private *priv = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 6542f220468f..c08a38402b93 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -103,11 +103,52 @@ exit:
103 return retval; 103 return retval;
104} 104}
105 105
106#ifdef CONFIG_HOTPLUG
107static ssize_t store_new_id(struct device_driver *driver,
108 const char *buf, size_t count)
109{
110 struct usb_serial_driver *usb_drv = to_usb_serial_driver(driver);
111 ssize_t retval = usb_store_new_id(&usb_drv->dynids, driver, buf, count);
112
113 if (retval >= 0 && usb_drv->usb_driver != NULL)
114 retval = usb_store_new_id(&usb_drv->usb_driver->dynids,
115 &usb_drv->usb_driver->drvwrap.driver,
116 buf, count);
117 return retval;
118}
119
120static struct driver_attribute drv_attrs[] = {
121 __ATTR(new_id, S_IWUSR, NULL, store_new_id),
122 __ATTR_NULL,
123};
124
125static void free_dynids(struct usb_serial_driver *drv)
126{
127 struct usb_dynid *dynid, *n;
128
129 spin_lock(&drv->dynids.lock);
130 list_for_each_entry_safe(dynid, n, &drv->dynids.list, node) {
131 list_del(&dynid->node);
132 kfree(dynid);
133 }
134 spin_unlock(&drv->dynids.lock);
135}
136
137#else
138static struct driver_attribute drv_attrs[] = {
139 __ATTR_NULL,
140};
141static inline void free_dynids(struct usb_driver *drv)
142{
143}
144#endif
145
106struct bus_type usb_serial_bus_type = { 146struct bus_type usb_serial_bus_type = {
107 .name = "usb-serial", 147 .name = "usb-serial",
108 .match = usb_serial_device_match, 148 .match = usb_serial_device_match,
109 .probe = usb_serial_device_probe, 149 .probe = usb_serial_device_probe,
110 .remove = usb_serial_device_remove, 150 .remove = usb_serial_device_remove,
151 .drv_attrs = drv_attrs,
111}; 152};
112 153
113int usb_serial_bus_register(struct usb_serial_driver *driver) 154int usb_serial_bus_register(struct usb_serial_driver *driver)
@@ -115,6 +156,9 @@ int usb_serial_bus_register(struct usb_serial_driver *driver)
115 int retval; 156 int retval;
116 157
117 driver->driver.bus = &usb_serial_bus_type; 158 driver->driver.bus = &usb_serial_bus_type;
159 spin_lock_init(&driver->dynids.lock);
160 INIT_LIST_HEAD(&driver->dynids.list);
161
118 retval = driver_register(&driver->driver); 162 retval = driver_register(&driver->driver);
119 163
120 return retval; 164 return retval;
@@ -122,6 +166,7 @@ int usb_serial_bus_register(struct usb_serial_driver *driver)
122 166
123void usb_serial_bus_deregister(struct usb_serial_driver *driver) 167void usb_serial_bus_deregister(struct usb_serial_driver *driver)
124{ 168{
169 free_dynids(driver);
125 driver_unregister(&driver->driver); 170 driver_unregister(&driver->driver);
126} 171}
127 172
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index 7167728d764c..9386e216d681 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -65,7 +65,7 @@ static int usb_console_setup(struct console *co, char *options)
65 struct usb_serial_port *port; 65 struct usb_serial_port *port;
66 int retval = 0; 66 int retval = 0;
67 struct tty_struct *tty; 67 struct tty_struct *tty;
68 struct termios *termios; 68 struct ktermios *termios;
69 69
70 dbg ("%s", __FUNCTION__); 70 dbg ("%s", __FUNCTION__);
71 71
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index f95d42c0d16a..3ec24870bca9 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -41,7 +41,7 @@ static int cp2101_open(struct usb_serial_port*, struct file*);
41static void cp2101_cleanup(struct usb_serial_port*); 41static void cp2101_cleanup(struct usb_serial_port*);
42static void cp2101_close(struct usb_serial_port*, struct file*); 42static void cp2101_close(struct usb_serial_port*, struct file*);
43static void cp2101_get_termios(struct usb_serial_port*); 43static void cp2101_get_termios(struct usb_serial_port*);
44static void cp2101_set_termios(struct usb_serial_port*, struct termios*); 44static void cp2101_set_termios(struct usb_serial_port*, struct ktermios*);
45static int cp2101_tiocmget (struct usb_serial_port *, struct file *); 45static int cp2101_tiocmget (struct usb_serial_port *, struct file *);
46static int cp2101_tiocmset (struct usb_serial_port *, struct file *, 46static int cp2101_tiocmset (struct usb_serial_port *, struct file *,
47 unsigned int, unsigned int); 47 unsigned int, unsigned int);
@@ -69,6 +69,7 @@ static struct usb_device_id id_table [] = {
69 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ 69 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
70 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 70 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
71 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 71 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
72 { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
72 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ 73 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
73 { } /* Terminating Entry */ 74 { } /* Terminating Entry */
74}; 75};
@@ -88,6 +89,7 @@ static struct usb_serial_driver cp2101_device = {
88 .owner = THIS_MODULE, 89 .owner = THIS_MODULE,
89 .name = "cp2101", 90 .name = "cp2101",
90 }, 91 },
92 .usb_driver = &cp2101_driver,
91 .id_table = id_table, 93 .id_table = id_table,
92 .num_interrupt_in = 0, 94 .num_interrupt_in = 0,
93 .num_bulk_in = 0, 95 .num_bulk_in = 0,
@@ -168,13 +170,13 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request,
168 unsigned int *data, int size) 170 unsigned int *data, int size)
169{ 171{
170 struct usb_serial *serial = port->serial; 172 struct usb_serial *serial = port->serial;
171 u32 *buf; 173 __le32 *buf;
172 int result, i, length; 174 int result, i, length;
173 175
174 /* Number of integers required to contain the array */ 176 /* Number of integers required to contain the array */
175 length = (((size - 1) | 3) + 1)/4; 177 length = (((size - 1) | 3) + 1)/4;
176 178
177 buf = kcalloc(length, sizeof(u32), GFP_KERNEL); 179 buf = kcalloc(length, sizeof(__le32), GFP_KERNEL);
178 if (!buf) { 180 if (!buf) {
179 dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); 181 dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__);
180 return -ENOMEM; 182 return -ENOMEM;
@@ -214,13 +216,13 @@ static int cp2101_set_config(struct usb_serial_port* port, u8 request,
214 unsigned int *data, int size) 216 unsigned int *data, int size)
215{ 217{
216 struct usb_serial *serial = port->serial; 218 struct usb_serial *serial = port->serial;
217 u32 *buf; 219 __le32 *buf;
218 int result, i, length; 220 int result, i, length;
219 221
220 /* Number of integers required to contain the array */ 222 /* Number of integers required to contain the array */
221 length = (((size - 1) | 3) + 1)/4; 223 length = (((size - 1) | 3) + 1)/4;
222 224
223 buf = kmalloc(length * sizeof(u32), GFP_KERNEL); 225 buf = kmalloc(length * sizeof(__le32), GFP_KERNEL);
224 if (!buf) { 226 if (!buf) {
225 dev_err(&port->dev, "%s - out of memory.\n", 227 dev_err(&port->dev, "%s - out of memory.\n",
226 __FUNCTION__); 228 __FUNCTION__);
@@ -506,7 +508,7 @@ static void cp2101_get_termios (struct usb_serial_port *port)
506} 508}
507 509
508static void cp2101_set_termios (struct usb_serial_port *port, 510static void cp2101_set_termios (struct usb_serial_port *port,
509 struct termios *old_termios) 511 struct ktermios *old_termios)
510{ 512{
511 unsigned int cflag, old_cflag=0; 513 unsigned int cflag, old_cflag=0;
512 int baud=0, bits; 514 int baud=0, bits;
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index a63c3286caa0..4167753ed31f 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -88,6 +88,7 @@ static struct usb_serial_driver cyberjack_device = {
88 .name = "cyberjack", 88 .name = "cyberjack",
89 }, 89 },
90 .description = "Reiner SCT Cyberjack USB card reader", 90 .description = "Reiner SCT Cyberjack USB card reader",
91 .usb_driver = &cyberjack_driver,
91 .id_table = id_table, 92 .id_table = id_table,
92 .num_interrupt_in = 1, 93 .num_interrupt_in = 1,
93 .num_bulk_in = 1, 94 .num_bulk_in = 1,
@@ -98,7 +99,7 @@ static struct usb_serial_driver cyberjack_device = {
98 .open = cyberjack_open, 99 .open = cyberjack_open,
99 .close = cyberjack_close, 100 .close = cyberjack_close,
100 .write = cyberjack_write, 101 .write = cyberjack_write,
101 .write_room = cyberjack_write_room, 102 .write_room = cyberjack_write_room,
102 .read_int_callback = cyberjack_read_int_callback, 103 .read_int_callback = cyberjack_read_int_callback,
103 .read_bulk_callback = cyberjack_read_bulk_callback, 104 .read_bulk_callback = cyberjack_read_bulk_callback,
104 .write_bulk_callback = cyberjack_write_bulk_callback, 105 .write_bulk_callback = cyberjack_write_bulk_callback,
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 093f303b3189..57b8e27285fc 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -143,7 +143,7 @@ struct cypress_private {
143 wait_queue_head_t delta_msr_wait; /* used for TIOCMIWAIT */ 143 wait_queue_head_t delta_msr_wait; /* used for TIOCMIWAIT */
144 char prev_status, diff_status; /* used for TIOCMIWAIT */ 144 char prev_status, diff_status; /* used for TIOCMIWAIT */
145 /* we pass a pointer to this as the arguement sent to cypress_set_termios old_termios */ 145 /* we pass a pointer to this as the arguement sent to cypress_set_termios old_termios */
146 struct termios tmp_termios; /* stores the old termios settings */ 146 struct ktermios tmp_termios; /* stores the old termios settings */
147}; 147};
148 148
149/* write buffer structure */ 149/* write buffer structure */
@@ -165,7 +165,7 @@ static int cypress_write (struct usb_serial_port *port, const unsigned char *b
165static void cypress_send (struct usb_serial_port *port); 165static void cypress_send (struct usb_serial_port *port);
166static int cypress_write_room (struct usb_serial_port *port); 166static int cypress_write_room (struct usb_serial_port *port);
167static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); 167static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
168static void cypress_set_termios (struct usb_serial_port *port, struct termios * old); 168static void cypress_set_termios (struct usb_serial_port *port, struct ktermios * old);
169static int cypress_tiocmget (struct usb_serial_port *port, struct file *file); 169static int cypress_tiocmget (struct usb_serial_port *port, struct file *file);
170static int cypress_tiocmset (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear); 170static int cypress_tiocmset (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear);
171static int cypress_chars_in_buffer (struct usb_serial_port *port); 171static int cypress_chars_in_buffer (struct usb_serial_port *port);
@@ -193,6 +193,7 @@ static struct usb_serial_driver cypress_earthmate_device = {
193 .name = "earthmate", 193 .name = "earthmate",
194 }, 194 },
195 .description = "DeLorme Earthmate USB", 195 .description = "DeLorme Earthmate USB",
196 .usb_driver = &cypress_driver,
196 .id_table = id_table_earthmate, 197 .id_table = id_table_earthmate,
197 .num_interrupt_in = 1, 198 .num_interrupt_in = 1,
198 .num_interrupt_out = 1, 199 .num_interrupt_out = 1,
@@ -222,6 +223,7 @@ static struct usb_serial_driver cypress_hidcom_device = {
222 .name = "cyphidcom", 223 .name = "cyphidcom",
223 }, 224 },
224 .description = "HID->COM RS232 Adapter", 225 .description = "HID->COM RS232 Adapter",
226 .usb_driver = &cypress_driver,
225 .id_table = id_table_cyphidcomrs232, 227 .id_table = id_table_cyphidcomrs232,
226 .num_interrupt_in = 1, 228 .num_interrupt_in = 1,
227 .num_interrupt_out = 1, 229 .num_interrupt_out = 1,
@@ -251,6 +253,7 @@ static struct usb_serial_driver cypress_ca42v2_device = {
251 .name = "nokiaca42v2", 253 .name = "nokiaca42v2",
252 }, 254 },
253 .description = "Nokia CA-42 V2 Adapter", 255 .description = "Nokia CA-42 V2 Adapter",
256 .usb_driver = &cypress_driver,
254 .id_table = id_table_nokiaca42v2, 257 .id_table = id_table_nokiaca42v2,
255 .num_interrupt_in = 1, 258 .num_interrupt_in = 1,
256 .num_interrupt_out = 1, 259 .num_interrupt_out = 1,
@@ -949,28 +952,13 @@ static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsi
949 952
950 switch (cmd) { 953 switch (cmd) {
951 case TIOCGSERIAL: 954 case TIOCGSERIAL:
952 if (copy_to_user((void __user *)arg, port->tty->termios, sizeof(struct termios))) { 955 if (copy_to_user((void __user *)arg, port->tty->termios, sizeof(struct ktermios))) {
953 return -EFAULT; 956 return -EFAULT;
954 } 957 }
955 return (0); 958 return (0);
956 break; 959 break;
957 case TIOCSSERIAL: 960 case TIOCSSERIAL:
958 if (copy_from_user(port->tty->termios, (void __user *)arg, sizeof(struct termios))) { 961 if (copy_from_user(port->tty->termios, (void __user *)arg, sizeof(struct ktermios))) {
959 return -EFAULT;
960 }
961 /* here we need to call cypress_set_termios to invoke the new settings */
962 cypress_set_termios(port, &priv->tmp_termios);
963 return (0);
964 break;
965 /* these are called when setting baud rate from gpsd */
966 case TCGETS:
967 if (copy_to_user((void __user *)arg, port->tty->termios, sizeof(struct termios))) {
968 return -EFAULT;
969 }
970 return (0);
971 break;
972 case TCSETS:
973 if (copy_from_user(port->tty->termios, (void __user *)arg, sizeof(struct termios))) {
974 return -EFAULT; 962 return -EFAULT;
975 } 963 }
976 /* here we need to call cypress_set_termios to invoke the new settings */ 964 /* here we need to call cypress_set_termios to invoke the new settings */
@@ -1019,7 +1007,7 @@ static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsi
1019 1007
1020 1008
1021static void cypress_set_termios (struct usb_serial_port *port, 1009static void cypress_set_termios (struct usb_serial_port *port,
1022 struct termios *old_termios) 1010 struct ktermios *old_termios)
1023{ 1011{
1024 struct cypress_private *priv = usb_get_serial_port_data(port); 1012 struct cypress_private *priv = usb_get_serial_port_data(port);
1025 struct tty_struct *tty; 1013 struct tty_struct *tty;
@@ -1493,7 +1481,7 @@ static struct cypress_buf *cypress_buf_alloc(unsigned int size)
1493 if (size == 0) 1481 if (size == 0)
1494 return NULL; 1482 return NULL;
1495 1483
1496 cb = (struct cypress_buf *)kmalloc(sizeof(struct cypress_buf), GFP_KERNEL); 1484 cb = kmalloc(sizeof(struct cypress_buf), GFP_KERNEL);
1497 if (cb == NULL) 1485 if (cb == NULL)
1498 return NULL; 1486 return NULL;
1499 1487
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 83d0e21145b0..0b0fb51bad3e 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -449,7 +449,7 @@ static int digi_transmit_idle( struct usb_serial_port *port,
449static void digi_rx_throttle (struct usb_serial_port *port); 449static void digi_rx_throttle (struct usb_serial_port *port);
450static void digi_rx_unthrottle (struct usb_serial_port *port); 450static void digi_rx_unthrottle (struct usb_serial_port *port);
451static void digi_set_termios( struct usb_serial_port *port, 451static void digi_set_termios( struct usb_serial_port *port,
452 struct termios *old_termios ); 452 struct ktermios *old_termios );
453static void digi_break_ctl( struct usb_serial_port *port, int break_state ); 453static void digi_break_ctl( struct usb_serial_port *port, int break_state );
454static int digi_ioctl( struct usb_serial_port *port, struct file *file, 454static int digi_ioctl( struct usb_serial_port *port, struct file *file,
455 unsigned int cmd, unsigned long arg ); 455 unsigned int cmd, unsigned long arg );
@@ -509,6 +509,7 @@ static struct usb_serial_driver digi_acceleport_2_device = {
509 .name = "digi_2", 509 .name = "digi_2",
510 }, 510 },
511 .description = "Digi 2 port USB adapter", 511 .description = "Digi 2 port USB adapter",
512 .usb_driver = &digi_driver,
512 .id_table = id_table_2, 513 .id_table = id_table_2,
513 .num_interrupt_in = 0, 514 .num_interrupt_in = 0,
514 .num_bulk_in = 4, 515 .num_bulk_in = 4,
@@ -538,6 +539,7 @@ static struct usb_serial_driver digi_acceleport_4_device = {
538 .name = "digi_4", 539 .name = "digi_4",
539 }, 540 },
540 .description = "Digi 4 port USB adapter", 541 .description = "Digi 4 port USB adapter",
542 .usb_driver = &digi_driver,
541 .id_table = id_table_4, 543 .id_table = id_table_4,
542 .num_interrupt_in = 0, 544 .num_interrupt_in = 0,
543 .num_bulk_in = 5, 545 .num_bulk_in = 5,
@@ -976,7 +978,7 @@ dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num );
976 978
977 979
978static void digi_set_termios( struct usb_serial_port *port, 980static void digi_set_termios( struct usb_serial_port *port,
979 struct termios *old_termios ) 981 struct ktermios *old_termios )
980{ 982{
981 983
982 struct digi_port *priv = usb_get_serial_port_data(port); 984 struct digi_port *priv = usb_get_serial_port_data(port);
@@ -1463,7 +1465,7 @@ static int digi_open( struct usb_serial_port *port, struct file *filp )
1463 int ret; 1465 int ret;
1464 unsigned char buf[32]; 1466 unsigned char buf[32];
1465 struct digi_port *priv = usb_get_serial_port_data(port); 1467 struct digi_port *priv = usb_get_serial_port_data(port);
1466 struct termios not_termios; 1468 struct ktermios not_termios;
1467 unsigned long flags = 0; 1469 unsigned long flags = 0;
1468 1470
1469 1471
@@ -1681,7 +1683,7 @@ dbg( "digi_startup: TOP" );
1681 for( i=0; i<serial->type->num_ports+1; i++ ) { 1683 for( i=0; i<serial->type->num_ports+1; i++ ) {
1682 1684
1683 /* allocate port private structure */ 1685 /* allocate port private structure */
1684 priv = (struct digi_port *)kmalloc( sizeof(struct digi_port), 1686 priv = kmalloc( sizeof(struct digi_port),
1685 GFP_KERNEL ); 1687 GFP_KERNEL );
1686 if( priv == (struct digi_port *)0 ) { 1688 if( priv == (struct digi_port *)0 ) {
1687 while( --i >= 0 ) 1689 while( --i >= 0 )
@@ -1714,7 +1716,7 @@ dbg( "digi_startup: TOP" );
1714 } 1716 }
1715 1717
1716 /* allocate serial private structure */ 1718 /* allocate serial private structure */
1717 serial_priv = (struct digi_serial *)kmalloc( sizeof(struct digi_serial), 1719 serial_priv = kmalloc( sizeof(struct digi_serial),
1718 GFP_KERNEL ); 1720 GFP_KERNEL );
1719 if( serial_priv == (struct digi_serial *)0 ) { 1721 if( serial_priv == (struct digi_serial *)0 ) {
1720 for( i=0; i<serial->type->num_ports+1; i++ ) 1722 for( i=0; i<serial->type->num_ports+1; i++ )
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index 4ce10a831953..4703c8f85383 100644
--- a/drivers/usb/serial/empeg.c
+++ b/drivers/usb/serial/empeg.c
@@ -92,7 +92,7 @@ static int empeg_ioctl (struct usb_serial_port *port,
92 struct file * file, 92 struct file * file,
93 unsigned int cmd, 93 unsigned int cmd,
94 unsigned long arg); 94 unsigned long arg);
95static void empeg_set_termios (struct usb_serial_port *port, struct termios *old_termios); 95static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios);
96static void empeg_write_bulk_callback (struct urb *urb); 96static void empeg_write_bulk_callback (struct urb *urb);
97static void empeg_read_bulk_callback (struct urb *urb); 97static void empeg_read_bulk_callback (struct urb *urb);
98 98
@@ -117,6 +117,7 @@ static struct usb_serial_driver empeg_device = {
117 .name = "empeg", 117 .name = "empeg",
118 }, 118 },
119 .id_table = id_table, 119 .id_table = id_table,
120 .usb_driver = &empeg_driver,
120 .num_interrupt_in = 0, 121 .num_interrupt_in = 0,
121 .num_bulk_in = 1, 122 .num_bulk_in = 1,
122 .num_bulk_out = 1, 123 .num_bulk_out = 1,
@@ -442,7 +443,7 @@ static int empeg_ioctl (struct usb_serial_port *port, struct file * file, unsign
442} 443}
443 444
444 445
445static void empeg_set_termios (struct usb_serial_port *port, struct termios *old_termios) 446static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
446{ 447{
447 448
448 dbg("%s - port %d", __FUNCTION__, port->number); 449 dbg("%s - port %d", __FUNCTION__, port->number);
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 72e4d48f51e9..4695952b6470 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -452,6 +452,7 @@ static struct usb_device_id id_table_combined [] = {
452 { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) }, 452 { USB_DEVICE(FTDI_VID, LINX_FUTURE_2_PID) },
453 { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, 453 { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) },
454 { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, 454 { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) },
455 { USB_DEVICE(FTDI_VID, FTDI_CCSMACHX_2_PID) },
455 { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, 456 { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) },
456 { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, 457 { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) },
457 { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, 458 { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) },
@@ -463,7 +464,6 @@ static struct usb_device_id id_table_combined [] = {
463 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, 464 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
464 { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, 465 { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) },
465 { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) }, 466 { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) },
466 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID) },
467 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, 467 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) },
468 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, 468 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) },
469 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) }, 469 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) },
@@ -595,7 +595,7 @@ static int ftdi_chars_in_buffer (struct usb_serial_port *port);
595static void ftdi_write_bulk_callback (struct urb *urb); 595static void ftdi_write_bulk_callback (struct urb *urb);
596static void ftdi_read_bulk_callback (struct urb *urb); 596static void ftdi_read_bulk_callback (struct urb *urb);
597static void ftdi_process_read (struct work_struct *work); 597static void ftdi_process_read (struct work_struct *work);
598static void ftdi_set_termios (struct usb_serial_port *port, struct termios * old); 598static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios * old);
599static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file); 599static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file);
600static int ftdi_tiocmset (struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear); 600static int ftdi_tiocmset (struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear);
601static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); 601static int ftdi_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
@@ -614,6 +614,7 @@ static struct usb_serial_driver ftdi_sio_device = {
614 .name = "ftdi_sio", 614 .name = "ftdi_sio",
615 }, 615 },
616 .description = "FTDI USB Serial Device", 616 .description = "FTDI USB Serial Device",
617 .usb_driver = &ftdi_driver ,
617 .id_table = id_table_combined, 618 .id_table = id_table_combined,
618 .num_interrupt_in = 0, 619 .num_interrupt_in = 0,
619 .num_bulk_in = 1, 620 .num_bulk_in = 1,
@@ -1880,7 +1881,7 @@ static void ftdi_break_ctl( struct usb_serial_port *port, int break_state )
1880 * WARNING: set_termios calls this with old_termios in kernel space 1881 * WARNING: set_termios calls this with old_termios in kernel space
1881 */ 1882 */
1882 1883
1883static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_termios) 1884static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
1884{ /* ftdi_termios */ 1885{ /* ftdi_termios */
1885 struct usb_device *dev = port->serial->dev; 1886 struct usb_device *dev = port->serial->dev;
1886 unsigned int cflag = port->tty->termios->c_cflag; 1887 unsigned int cflag = port->tty->termios->c_cflag;
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index bae117d359af..7eff1c03ba80 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -312,8 +312,9 @@
312 312
313/* CCS Inc. ICDU/ICDU40 product ID - the FT232BM is used in an in-circuit-debugger */ 313/* CCS Inc. ICDU/ICDU40 product ID - the FT232BM is used in an in-circuit-debugger */
314/* unit for PIC16's/PIC18's */ 314/* unit for PIC16's/PIC18's */
315#define FTDI_CCSICDU20_0_PID 0xF9D0 315#define FTDI_CCSICDU20_0_PID 0xF9D0
316#define FTDI_CCSICDU40_1_PID 0xF9D1 316#define FTDI_CCSICDU40_1_PID 0xF9D1
317#define FTDI_CCSMACHX_2_PID 0xF9D2
317 318
318/* Inside Accesso contactless reader (http://www.insidefr.com) */ 319/* Inside Accesso contactless reader (http://www.insidefr.com) */
319#define INSIDE_ACCESSO 0xFAD0 320#define INSIDE_ACCESSO 0xFAD0
@@ -363,7 +364,6 @@
363 * USB-TTY activ, USB-TTY passiv. Some PIDs are used by several devices 364 * USB-TTY activ, USB-TTY passiv. Some PIDs are used by several devices
364 * and I'm not entirely sure which are used by which. 365 * and I'm not entirely sure which are used by which.
365 */ 366 */
366#define FTDI_4N_GALAXY_DE_0_PID 0x8372
367#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0 367#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0
368#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1 368#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1
369 369
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c
index 77b977206a8c..4092f6dc9efd 100644
--- a/drivers/usb/serial/funsoft.c
+++ b/drivers/usb/serial/funsoft.c
@@ -14,6 +14,9 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/usb.h> 15#include <linux/usb.h>
16#include <linux/usb/serial.h> 16#include <linux/usb/serial.h>
17#include <asm/uaccess.h>
18
19static int debug;
17 20
18static struct usb_device_id id_table [] = { 21static struct usb_device_id id_table [] = {
19 { USB_DEVICE(0x1404, 0xcddc) }, 22 { USB_DEVICE(0x1404, 0xcddc) },
@@ -21,6 +24,26 @@ static struct usb_device_id id_table [] = {
21}; 24};
22MODULE_DEVICE_TABLE(usb, id_table); 25MODULE_DEVICE_TABLE(usb, id_table);
23 26
27static int funsoft_ioctl(struct usb_serial_port *port, struct file *file,
28 unsigned int cmd, unsigned long arg)
29{
30 struct ktermios t;
31
32 dbg("%s - port %d, cmd 0x%04x", __FUNCTION__, port->number, cmd);
33
34 if (cmd == TCSETSF) {
35 if (user_termios_to_kernel_termios(&t, (struct termios __user *)arg))
36 return -EFAULT;
37
38 dbg("%s - iflag:%x oflag:%x cflag:%x lflag:%x", __FUNCTION__,
39 t.c_iflag, t.c_oflag, t.c_cflag, t.c_lflag);
40
41 if (!(t.c_lflag & ICANON))
42 return -EINVAL;
43 }
44 return -ENOIOCTLCMD;
45}
46
24static struct usb_driver funsoft_driver = { 47static struct usb_driver funsoft_driver = {
25 .name = "funsoft", 48 .name = "funsoft",
26 .probe = usb_serial_probe, 49 .probe = usb_serial_probe,
@@ -35,10 +58,12 @@ static struct usb_serial_driver funsoft_device = {
35 .name = "funsoft", 58 .name = "funsoft",
36 }, 59 },
37 .id_table = id_table, 60 .id_table = id_table,
61 .usb_driver = &funsoft_driver,
38 .num_interrupt_in = NUM_DONT_CARE, 62 .num_interrupt_in = NUM_DONT_CARE,
39 .num_bulk_in = NUM_DONT_CARE, 63 .num_bulk_in = NUM_DONT_CARE,
40 .num_bulk_out = NUM_DONT_CARE, 64 .num_bulk_out = NUM_DONT_CARE,
41 .num_ports = 1, 65 .num_ports = 1,
66 .ioctl = funsoft_ioctl,
42}; 67};
43 68
44static int __init funsoft_init(void) 69static int __init funsoft_init(void)
@@ -63,3 +88,6 @@ static void __exit funsoft_exit(void)
63module_init(funsoft_init); 88module_init(funsoft_init);
64module_exit(funsoft_exit); 89module_exit(funsoft_exit);
65MODULE_LICENSE("GPL"); 90MODULE_LICENSE("GPL");
91
92module_param(debug, bool, S_IRUGO | S_IWUSR);
93MODULE_PARM_DESC(debug, "Debug enabled or not");
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 6530d391ebed..74660a3aa670 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1566,6 +1566,7 @@ static struct usb_serial_driver garmin_device = {
1566 .name = "garmin_gps", 1566 .name = "garmin_gps",
1567 }, 1567 },
1568 .description = "Garmin GPS usb/tty", 1568 .description = "Garmin GPS usb/tty",
1569 .usb_driver = &garmin_driver,
1569 .id_table = id_table, 1570 .id_table = id_table,
1570 .num_interrupt_in = 1, 1571 .num_interrupt_in = 1,
1571 .num_bulk_in = 1, 1572 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 36042937e77f..601e0648dec6 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -20,6 +20,10 @@
20#include <linux/usb/serial.h> 20#include <linux/usb/serial.h>
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22 22
23static int generic_probe(struct usb_interface *interface,
24 const struct usb_device_id *id);
25
26
23static int debug; 27static int debug;
24 28
25#ifdef CONFIG_USB_SERIAL_GENERIC 29#ifdef CONFIG_USB_SERIAL_GENERIC
@@ -34,6 +38,21 @@ MODULE_PARM_DESC(product, "User specified USB idProduct");
34 38
35static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */ 39static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
36 40
41/* we want to look at all devices, as the vendor/product id can change
42 * depending on the command line argument */
43static struct usb_device_id generic_serial_ids[] = {
44 {.driver_info = 42},
45 {}
46};
47
48static struct usb_driver generic_driver = {
49 .name = "usbserial_generic",
50 .probe = generic_probe,
51 .disconnect = usb_serial_disconnect,
52 .id_table = generic_serial_ids,
53 .no_dynamic_id = 1,
54};
55
37/* All of the device info needed for the Generic Serial Converter */ 56/* All of the device info needed for the Generic Serial Converter */
38struct usb_serial_driver usb_serial_generic_device = { 57struct usb_serial_driver usb_serial_generic_device = {
39 .driver = { 58 .driver = {
@@ -41,6 +60,7 @@ struct usb_serial_driver usb_serial_generic_device = {
41 .name = "generic", 60 .name = "generic",
42 }, 61 },
43 .id_table = generic_device_ids, 62 .id_table = generic_device_ids,
63 .usb_driver = &generic_driver,
44 .num_interrupt_in = NUM_DONT_CARE, 64 .num_interrupt_in = NUM_DONT_CARE,
45 .num_bulk_in = NUM_DONT_CARE, 65 .num_bulk_in = NUM_DONT_CARE,
46 .num_bulk_out = NUM_DONT_CARE, 66 .num_bulk_out = NUM_DONT_CARE,
@@ -48,13 +68,6 @@ struct usb_serial_driver usb_serial_generic_device = {
48 .shutdown = usb_serial_generic_shutdown, 68 .shutdown = usb_serial_generic_shutdown,
49}; 69};
50 70
51/* we want to look at all devices, as the vendor/product id can change
52 * depending on the command line argument */
53static struct usb_device_id generic_serial_ids[] = {
54 {.driver_info = 42},
55 {}
56};
57
58static int generic_probe(struct usb_interface *interface, 71static int generic_probe(struct usb_interface *interface,
59 const struct usb_device_id *id) 72 const struct usb_device_id *id)
60{ 73{
@@ -65,14 +78,6 @@ static int generic_probe(struct usb_interface *interface,
65 return usb_serial_probe(interface, id); 78 return usb_serial_probe(interface, id);
66 return -ENODEV; 79 return -ENODEV;
67} 80}
68
69static struct usb_driver generic_driver = {
70 .name = "usbserial_generic",
71 .probe = generic_probe,
72 .disconnect = usb_serial_disconnect,
73 .id_table = generic_serial_ids,
74 .no_dynamic_id = 1,
75};
76#endif 81#endif
77 82
78int usb_serial_generic_register (int _debug) 83int usb_serial_generic_register (int _debug)
diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c
index ebcac701b069..6c6ebae741c9 100644
--- a/drivers/usb/serial/hp4x.c
+++ b/drivers/usb/serial/hp4x.c
@@ -49,6 +49,7 @@ static struct usb_serial_driver hp49gp_device = {
49 .name = "hp4X", 49 .name = "hp4X",
50 }, 50 },
51 .id_table = id_table, 51 .id_table = id_table,
52 .usb_driver = &hp49gp_driver,
52 .num_interrupt_in = NUM_DONT_CARE, 53 .num_interrupt_in = NUM_DONT_CARE,
53 .num_bulk_in = NUM_DONT_CARE, 54 .num_bulk_in = NUM_DONT_CARE,
54 .num_bulk_out = NUM_DONT_CARE, 55 .num_bulk_out = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index d06547a13f28..6a26a2e683a6 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -146,6 +146,8 @@ struct edgeport_serial {
146 struct edge_manuf_descriptor manuf_descriptor; /* the manufacturer descriptor */ 146 struct edge_manuf_descriptor manuf_descriptor; /* the manufacturer descriptor */
147 struct edge_boot_descriptor boot_descriptor; /* the boot firmware descriptor */ 147 struct edge_boot_descriptor boot_descriptor; /* the boot firmware descriptor */
148 struct edgeport_product_info product_info; /* Product Info */ 148 struct edgeport_product_info product_info; /* Product Info */
149 struct edge_compatibility_descriptor epic_descriptor; /* Edgeport compatible descriptor */
150 int is_epic; /* flag if EPiC device or not */
149 151
150 __u8 interrupt_in_endpoint; /* the interrupt endpoint handle */ 152 __u8 interrupt_in_endpoint; /* the interrupt endpoint handle */
151 unsigned char * interrupt_in_buffer; /* the buffer we use for the interrupt endpoint */ 153 unsigned char * interrupt_in_buffer; /* the buffer we use for the interrupt endpoint */
@@ -229,7 +231,7 @@ static int edge_write_room (struct usb_serial_port *port);
229static int edge_chars_in_buffer (struct usb_serial_port *port); 231static int edge_chars_in_buffer (struct usb_serial_port *port);
230static void edge_throttle (struct usb_serial_port *port); 232static void edge_throttle (struct usb_serial_port *port);
231static void edge_unthrottle (struct usb_serial_port *port); 233static void edge_unthrottle (struct usb_serial_port *port);
232static void edge_set_termios (struct usb_serial_port *port, struct termios *old_termios); 234static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios);
233static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned int cmd, unsigned long arg); 235static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned int cmd, unsigned long arg);
234static void edge_break (struct usb_serial_port *port, int break_state); 236static void edge_break (struct usb_serial_port *port, int break_state);
235static int edge_tiocmget (struct usb_serial_port *port, struct file *file); 237static int edge_tiocmget (struct usb_serial_port *port, struct file *file);
@@ -240,14 +242,6 @@ static void edge_shutdown (struct usb_serial *serial);
240 242
241#include "io_tables.h" /* all of the devices that this driver supports */ 243#include "io_tables.h" /* all of the devices that this driver supports */
242 244
243static struct usb_driver io_driver = {
244 .name = "io_edgeport",
245 .probe = usb_serial_probe,
246 .disconnect = usb_serial_disconnect,
247 .id_table = id_table_combined,
248 .no_dynamic_id = 1,
249};
250
251/* function prototypes for all of our local functions */ 245/* function prototypes for all of our local functions */
252static void process_rcvd_data (struct edgeport_serial *edge_serial, unsigned char *buffer, __u16 bufferLength); 246static void process_rcvd_data (struct edgeport_serial *edge_serial, unsigned char *buffer, __u16 bufferLength);
253static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2, __u8 byte3); 247static void process_rcvd_status (struct edgeport_serial *edge_serial, __u8 byte2, __u8 byte3);
@@ -257,7 +251,7 @@ static void handle_new_lsr (struct edgeport_port *edge_port, __u8 lsrData, __u8
257static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u8 param); 251static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u8 param);
258static int calc_baud_rate_divisor (int baud_rate, int *divisor); 252static int calc_baud_rate_divisor (int baud_rate, int *divisor);
259static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRate); 253static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRate);
260static void change_port_settings (struct edgeport_port *edge_port, struct termios *old_termios); 254static void change_port_settings (struct edgeport_port *edge_port, struct ktermios *old_termios);
261static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 regNum, __u8 regValue); 255static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 regNum, __u8 regValue);
262static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer, int writeLength); 256static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer, int writeLength);
263static void send_more_port_data (struct edgeport_serial *edge_serial, struct edgeport_port *edge_port); 257static void send_more_port_data (struct edgeport_serial *edge_serial, struct edgeport_port *edge_port);
@@ -397,6 +391,7 @@ static int get_string (struct usb_device *dev, int Id, char *string, int buflen)
397 unicode_to_ascii(string, buflen, pStringDesc->wData, pStringDesc->bLength/2); 391 unicode_to_ascii(string, buflen, pStringDesc->wData, pStringDesc->bLength/2);
398 392
399 kfree(pStringDesc); 393 kfree(pStringDesc);
394 dbg("%s - USB String %s", __FUNCTION__, string);
400 return strlen(string); 395 return strlen(string);
401} 396}
402 397
@@ -434,6 +429,34 @@ static int get_string_desc (struct usb_device *dev, int Id, struct usb_string_de
434} 429}
435#endif 430#endif
436 431
432static void dump_product_info(struct edgeport_product_info *product_info)
433{
434 // Dump Product Info structure
435 dbg("**Product Information:");
436 dbg(" ProductId %x", product_info->ProductId );
437 dbg(" NumPorts %d", product_info->NumPorts );
438 dbg(" ProdInfoVer %d", product_info->ProdInfoVer );
439 dbg(" IsServer %d", product_info->IsServer);
440 dbg(" IsRS232 %d", product_info->IsRS232 );
441 dbg(" IsRS422 %d", product_info->IsRS422 );
442 dbg(" IsRS485 %d", product_info->IsRS485 );
443 dbg(" RomSize %d", product_info->RomSize );
444 dbg(" RamSize %d", product_info->RamSize );
445 dbg(" CpuRev %x", product_info->CpuRev );
446 dbg(" BoardRev %x", product_info->BoardRev);
447 dbg(" BootMajorVersion %d.%d.%d", product_info->BootMajorVersion,
448 product_info->BootMinorVersion,
449 le16_to_cpu(product_info->BootBuildNumber));
450 dbg(" FirmwareMajorVersion %d.%d.%d", product_info->FirmwareMajorVersion,
451 product_info->FirmwareMinorVersion,
452 le16_to_cpu(product_info->FirmwareBuildNumber));
453 dbg(" ManufactureDescDate %d/%d/%d", product_info->ManufactureDescDate[0],
454 product_info->ManufactureDescDate[1],
455 product_info->ManufactureDescDate[2]+1900);
456 dbg(" iDownloadFile 0x%x", product_info->iDownloadFile);
457 dbg(" EpicVer %d", product_info->EpicVer);
458}
459
437static void get_product_info(struct edgeport_serial *edge_serial) 460static void get_product_info(struct edgeport_serial *edge_serial)
438{ 461{
439 struct edgeport_product_info *product_info = &edge_serial->product_info; 462 struct edgeport_product_info *product_info = &edge_serial->product_info;
@@ -495,30 +518,60 @@ static void get_product_info(struct edgeport_serial *edge_serial)
495 break; 518 break;
496 } 519 }
497 520
498 // Dump Product Info structure 521 dump_product_info(product_info);
499 dbg("**Product Information:"); 522}
500 dbg(" ProductId %x", product_info->ProductId );
501 dbg(" NumPorts %d", product_info->NumPorts );
502 dbg(" ProdInfoVer %d", product_info->ProdInfoVer );
503 dbg(" IsServer %d", product_info->IsServer);
504 dbg(" IsRS232 %d", product_info->IsRS232 );
505 dbg(" IsRS422 %d", product_info->IsRS422 );
506 dbg(" IsRS485 %d", product_info->IsRS485 );
507 dbg(" RomSize %d", product_info->RomSize );
508 dbg(" RamSize %d", product_info->RamSize );
509 dbg(" CpuRev %x", product_info->CpuRev );
510 dbg(" BoardRev %x", product_info->BoardRev);
511 dbg(" BootMajorVersion %d.%d.%d", product_info->BootMajorVersion,
512 product_info->BootMinorVersion,
513 le16_to_cpu(product_info->BootBuildNumber));
514 dbg(" FirmwareMajorVersion %d.%d.%d", product_info->FirmwareMajorVersion,
515 product_info->FirmwareMinorVersion,
516 le16_to_cpu(product_info->FirmwareBuildNumber));
517 dbg(" ManufactureDescDate %d/%d/%d", product_info->ManufactureDescDate[0],
518 product_info->ManufactureDescDate[1],
519 product_info->ManufactureDescDate[2]+1900);
520 dbg(" iDownloadFile 0x%x", product_info->iDownloadFile);
521 523
524static int get_epic_descriptor(struct edgeport_serial *ep)
525{
526 int result;
527 struct usb_serial *serial = ep->serial;
528 struct edgeport_product_info *product_info = &ep->product_info;
529 struct edge_compatibility_descriptor *epic = &ep->epic_descriptor;
530 struct edge_compatibility_bits *bits;
531
532 ep->is_epic = 0;
533 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
534 USB_REQUEST_ION_GET_EPIC_DESC,
535 0xC0, 0x00, 0x00,
536 &ep->epic_descriptor,
537 sizeof(struct edge_compatibility_descriptor),
538 300);
539
540 dbg("%s result = %d", __FUNCTION__, result);
541
542 if (result > 0) {
543 ep->is_epic = 1;
544 memset(product_info, 0, sizeof(struct edgeport_product_info));
545
546 product_info->NumPorts = epic->NumPorts;
547 product_info->ProdInfoVer = 0;
548 product_info->FirmwareMajorVersion = epic->MajorVersion;
549 product_info->FirmwareMinorVersion = epic->MinorVersion;
550 product_info->FirmwareBuildNumber = epic->BuildNumber;
551 product_info->iDownloadFile = epic->iDownloadFile;
552 product_info->EpicVer = epic->EpicVer;
553 product_info->Epic = epic->Supports;
554 product_info->ProductId = ION_DEVICE_ID_EDGEPORT_COMPATIBLE;
555 dump_product_info(product_info);
556
557 bits = &ep->epic_descriptor.Supports;
558 dbg("**EPIC descriptor:");
559 dbg(" VendEnableSuspend: %s", bits->VendEnableSuspend ? "TRUE": "FALSE");
560 dbg(" IOSPOpen : %s", bits->IOSPOpen ? "TRUE": "FALSE" );
561 dbg(" IOSPClose : %s", bits->IOSPClose ? "TRUE": "FALSE" );
562 dbg(" IOSPChase : %s", bits->IOSPChase ? "TRUE": "FALSE" );
563 dbg(" IOSPSetRxFlow : %s", bits->IOSPSetRxFlow ? "TRUE": "FALSE" );
564 dbg(" IOSPSetTxFlow : %s", bits->IOSPSetTxFlow ? "TRUE": "FALSE" );
565 dbg(" IOSPSetXChar : %s", bits->IOSPSetXChar ? "TRUE": "FALSE" );
566 dbg(" IOSPRxCheck : %s", bits->IOSPRxCheck ? "TRUE": "FALSE" );
567 dbg(" IOSPSetClrBreak : %s", bits->IOSPSetClrBreak ? "TRUE": "FALSE" );
568 dbg(" IOSPWriteMCR : %s", bits->IOSPWriteMCR ? "TRUE": "FALSE" );
569 dbg(" IOSPWriteLCR : %s", bits->IOSPWriteLCR ? "TRUE": "FALSE" );
570 dbg(" IOSPSetBaudRate : %s", bits->IOSPSetBaudRate ? "TRUE": "FALSE" );
571 dbg(" TrueEdgeport : %s", bits->TrueEdgeport ? "TRUE": "FALSE" );
572 }
573
574 return result;
522} 575}
523 576
524 577
@@ -1017,21 +1070,29 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
1017 1070
1018 edge_port->closePending = TRUE; 1071 edge_port->closePending = TRUE;
1019 1072
1020 /* flush and chase */ 1073 if ((!edge_serial->is_epic) ||
1021 edge_port->chaseResponsePending = TRUE; 1074 ((edge_serial->is_epic) &&
1022 1075 (edge_serial->epic_descriptor.Supports.IOSPChase))) {
1023 dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__); 1076 /* flush and chase */
1024 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); 1077 edge_port->chaseResponsePending = TRUE;
1025 if (status == 0) { 1078
1026 // block until chase finished 1079 dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__);
1027 block_until_chase_response(edge_port); 1080 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0);
1028 } else { 1081 if (status == 0) {
1029 edge_port->chaseResponsePending = FALSE; 1082 // block until chase finished
1083 block_until_chase_response(edge_port);
1084 } else {
1085 edge_port->chaseResponsePending = FALSE;
1086 }
1030 } 1087 }
1031 1088
1032 /* close the port */ 1089 if ((!edge_serial->is_epic) ||
1033 dbg("%s - Sending IOSP_CMD_CLOSE_PORT", __FUNCTION__); 1090 ((edge_serial->is_epic) &&
1034 send_iosp_ext_cmd (edge_port, IOSP_CMD_CLOSE_PORT, 0); 1091 (edge_serial->epic_descriptor.Supports.IOSPClose))) {
1092 /* close the port */
1093 dbg("%s - Sending IOSP_CMD_CLOSE_PORT", __FUNCTION__);
1094 send_iosp_ext_cmd (edge_port, IOSP_CMD_CLOSE_PORT, 0);
1095 }
1035 1096
1036 //port->close = TRUE; 1097 //port->close = TRUE;
1037 edge_port->closePending = FALSE; 1098 edge_port->closePending = FALSE;
@@ -1431,7 +1492,7 @@ static void edge_unthrottle (struct usb_serial_port *port)
1431 * SerialSetTermios 1492 * SerialSetTermios
1432 * this function is called by the tty driver when it wants to change the termios structure 1493 * this function is called by the tty driver when it wants to change the termios structure
1433 *****************************************************************************/ 1494 *****************************************************************************/
1434static void edge_set_termios (struct usb_serial_port *port, struct termios *old_termios) 1495static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
1435{ 1496{
1436 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1497 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1437 struct tty_struct *tty = port->tty; 1498 struct tty_struct *tty = port->tty;
@@ -1694,29 +1755,38 @@ static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned
1694static void edge_break (struct usb_serial_port *port, int break_state) 1755static void edge_break (struct usb_serial_port *port, int break_state)
1695{ 1756{
1696 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1757 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1758 struct edgeport_serial *edge_serial = usb_get_serial_data(port->serial);
1697 int status; 1759 int status;
1698 1760
1699 /* flush and chase */ 1761 if ((!edge_serial->is_epic) ||
1700 edge_port->chaseResponsePending = TRUE; 1762 ((edge_serial->is_epic) &&
1701 1763 (edge_serial->epic_descriptor.Supports.IOSPChase))) {
1702 dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__); 1764 /* flush and chase */
1703 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0); 1765 edge_port->chaseResponsePending = TRUE;
1704 if (status == 0) { 1766
1705 // block until chase finished 1767 dbg("%s - Sending IOSP_CMD_CHASE_PORT", __FUNCTION__);
1706 block_until_chase_response(edge_port); 1768 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CHASE_PORT, 0);
1707 } else { 1769 if (status == 0) {
1708 edge_port->chaseResponsePending = FALSE; 1770 // block until chase finished
1771 block_until_chase_response(edge_port);
1772 } else {
1773 edge_port->chaseResponsePending = FALSE;
1774 }
1709 } 1775 }
1710 1776
1711 if (break_state == -1) { 1777 if ((!edge_serial->is_epic) ||
1712 dbg("%s - Sending IOSP_CMD_SET_BREAK", __FUNCTION__); 1778 ((edge_serial->is_epic) &&
1713 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_BREAK, 0); 1779 (edge_serial->epic_descriptor.Supports.IOSPSetClrBreak))) {
1714 } else { 1780 if (break_state == -1) {
1715 dbg("%s - Sending IOSP_CMD_CLEAR_BREAK", __FUNCTION__); 1781 dbg("%s - Sending IOSP_CMD_SET_BREAK", __FUNCTION__);
1716 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CLEAR_BREAK, 0); 1782 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_BREAK, 0);
1717 } 1783 } else {
1718 if (status) { 1784 dbg("%s - Sending IOSP_CMD_CLEAR_BREAK", __FUNCTION__);
1719 dbg("%s - error sending break set/clear command.", __FUNCTION__); 1785 status = send_iosp_ext_cmd (edge_port, IOSP_CMD_CLEAR_BREAK, 0);
1786 }
1787 if (status) {
1788 dbg("%s - error sending break set/clear command.", __FUNCTION__);
1789 }
1720 } 1790 }
1721 1791
1722 return; 1792 return;
@@ -2288,6 +2358,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer
2288 *****************************************************************************/ 2358 *****************************************************************************/
2289static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRate) 2359static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRate)
2290{ 2360{
2361 struct edgeport_serial *edge_serial = usb_get_serial_data(edge_port->port->serial);
2291 unsigned char *cmdBuffer; 2362 unsigned char *cmdBuffer;
2292 unsigned char *currCmd; 2363 unsigned char *currCmd;
2293 int cmdLen = 0; 2364 int cmdLen = 0;
@@ -2295,6 +2366,14 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa
2295 int status; 2366 int status;
2296 unsigned char number = edge_port->port->number - edge_port->port->serial->minor; 2367 unsigned char number = edge_port->port->number - edge_port->port->serial->minor;
2297 2368
2369 if ((!edge_serial->is_epic) ||
2370 ((edge_serial->is_epic) &&
2371 (!edge_serial->epic_descriptor.Supports.IOSPSetBaudRate))) {
2372 dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d",
2373 edge_port->port->number, baudRate);
2374 return 0;
2375 }
2376
2298 dbg("%s - port = %d, baud = %d", __FUNCTION__, edge_port->port->number, baudRate); 2377 dbg("%s - port = %d, baud = %d", __FUNCTION__, edge_port->port->number, baudRate);
2299 2378
2300 status = calc_baud_rate_divisor (baudRate, &divisor); 2379 status = calc_baud_rate_divisor (baudRate, &divisor);
@@ -2374,6 +2453,7 @@ static int calc_baud_rate_divisor (int baudrate, int *divisor)
2374 *****************************************************************************/ 2453 *****************************************************************************/
2375static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 regNum, __u8 regValue) 2454static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 regNum, __u8 regValue)
2376{ 2455{
2456 struct edgeport_serial *edge_serial = usb_get_serial_data(edge_port->port->serial);
2377 unsigned char *cmdBuffer; 2457 unsigned char *cmdBuffer;
2378 unsigned char *currCmd; 2458 unsigned char *currCmd;
2379 unsigned long cmdLen = 0; 2459 unsigned long cmdLen = 0;
@@ -2381,6 +2461,22 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r
2381 2461
2382 dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue); 2462 dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue);
2383 2463
2464 if ((!edge_serial->is_epic) ||
2465 ((edge_serial->is_epic) &&
2466 (!edge_serial->epic_descriptor.Supports.IOSPWriteMCR) &&
2467 (regNum == MCR))) {
2468 dbg("SendCmdWriteUartReg - Not writting to MCR Register");
2469 return 0;
2470 }
2471
2472 if ((!edge_serial->is_epic) ||
2473 ((edge_serial->is_epic) &&
2474 (!edge_serial->epic_descriptor.Supports.IOSPWriteLCR) &&
2475 (regNum == LCR))) {
2476 dbg ("SendCmdWriteUartReg - Not writting to LCR Register");
2477 return 0;
2478 }
2479
2384 // Alloc memory for the string of commands. 2480 // Alloc memory for the string of commands.
2385 cmdBuffer = kmalloc (0x10, GFP_ATOMIC); 2481 cmdBuffer = kmalloc (0x10, GFP_ATOMIC);
2386 if (cmdBuffer == NULL ) { 2482 if (cmdBuffer == NULL ) {
@@ -2412,8 +2508,9 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r
2412#ifndef CMSPAR 2508#ifndef CMSPAR
2413#define CMSPAR 0 2509#define CMSPAR 0
2414#endif 2510#endif
2415static void change_port_settings (struct edgeport_port *edge_port, struct termios *old_termios) 2511static void change_port_settings (struct edgeport_port *edge_port, struct ktermios *old_termios)
2416{ 2512{
2513 struct edgeport_serial *edge_serial = usb_get_serial_data(edge_port->port->serial);
2417 struct tty_struct *tty; 2514 struct tty_struct *tty;
2418 int baud; 2515 int baud;
2419 unsigned cflag; 2516 unsigned cflag;
@@ -2494,8 +2591,12 @@ static void change_port_settings (struct edgeport_port *edge_port, struct termio
2494 unsigned char stop_char = STOP_CHAR(tty); 2591 unsigned char stop_char = STOP_CHAR(tty);
2495 unsigned char start_char = START_CHAR(tty); 2592 unsigned char start_char = START_CHAR(tty);
2496 2593
2497 send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_XON_CHAR, start_char); 2594 if ((!edge_serial->is_epic) ||
2498 send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_XOFF_CHAR, stop_char); 2595 ((edge_serial->is_epic) &&
2596 (edge_serial->epic_descriptor.Supports.IOSPSetXChar))) {
2597 send_iosp_ext_cmd(edge_port, IOSP_CMD_SET_XON_CHAR, start_char);
2598 send_iosp_ext_cmd(edge_port, IOSP_CMD_SET_XOFF_CHAR, stop_char);
2599 }
2499 2600
2500 /* if we are implementing INBOUND XON/XOFF */ 2601 /* if we are implementing INBOUND XON/XOFF */
2501 if (I_IXOFF(tty)) { 2602 if (I_IXOFF(tty)) {
@@ -2515,8 +2616,14 @@ static void change_port_settings (struct edgeport_port *edge_port, struct termio
2515 } 2616 }
2516 2617
2517 /* Set flow control to the configured value */ 2618 /* Set flow control to the configured value */
2518 send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_RX_FLOW, rxFlow); 2619 if ((!edge_serial->is_epic) ||
2519 send_iosp_ext_cmd (edge_port, IOSP_CMD_SET_TX_FLOW, txFlow); 2620 ((edge_serial->is_epic) &&
2621 (edge_serial->epic_descriptor.Supports.IOSPSetRxFlow)))
2622 send_iosp_ext_cmd(edge_port, IOSP_CMD_SET_RX_FLOW, rxFlow);
2623 if ((!edge_serial->is_epic) ||
2624 ((edge_serial->is_epic) &&
2625 (edge_serial->epic_descriptor.Supports.IOSPSetTxFlow)))
2626 send_iosp_ext_cmd(edge_port, IOSP_CMD_SET_TX_FLOW, txFlow);
2520 2627
2521 2628
2522 edge_port->shadowLCR &= ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK); 2629 edge_port->shadowLCR &= ~(LCR_BITS_MASK | LCR_STOP_MASK | LCR_PAR_MASK);
@@ -2728,6 +2835,13 @@ static int edge_startup (struct usb_serial *serial)
2728 struct edgeport_port *edge_port; 2835 struct edgeport_port *edge_port;
2729 struct usb_device *dev; 2836 struct usb_device *dev;
2730 int i, j; 2837 int i, j;
2838 int response;
2839 int interrupt_in_found;
2840 int bulk_in_found;
2841 int bulk_out_found;
2842 static __u32 descriptor[3] = { EDGE_COMPATIBILITY_MASK0,
2843 EDGE_COMPATIBILITY_MASK1,
2844 EDGE_COMPATIBILITY_MASK2 };
2731 2845
2732 dev = serial->dev; 2846 dev = serial->dev;
2733 2847
@@ -2750,38 +2864,50 @@ static int edge_startup (struct usb_serial *serial)
2750 2864
2751 dev_info(&serial->dev->dev, "%s detected\n", edge_serial->name); 2865 dev_info(&serial->dev->dev, "%s detected\n", edge_serial->name);
2752 2866
2753 /* get the manufacturing descriptor for this device */ 2867 /* Read the epic descriptor */
2754 get_manufacturing_desc (edge_serial); 2868 if (get_epic_descriptor(edge_serial) <= 0) {
2869 /* memcpy descriptor to Supports structures */
2870 memcpy(&edge_serial->epic_descriptor.Supports, descriptor,
2871 sizeof(struct edge_compatibility_bits));
2872
2873 /* get the manufacturing descriptor for this device */
2874 get_manufacturing_desc (edge_serial);
2755 2875
2756 /* get the boot descriptor */ 2876 /* get the boot descriptor */
2757 get_boot_desc (edge_serial); 2877 get_boot_desc (edge_serial);
2758 2878
2759 get_product_info(edge_serial); 2879 get_product_info(edge_serial);
2880 }
2760 2881
2761 /* set the number of ports from the manufacturing description */ 2882 /* set the number of ports from the manufacturing description */
2762 /* serial->num_ports = serial->product_info.NumPorts; */ 2883 /* serial->num_ports = serial->product_info.NumPorts; */
2763 if (edge_serial->product_info.NumPorts != serial->num_ports) { 2884 if ((!edge_serial->is_epic) &&
2764 warn("%s - Device Reported %d serial ports vs core " 2885 (edge_serial->product_info.NumPorts != serial->num_ports)) {
2765 "thinking we have %d ports, email greg@kroah.com this info.", 2886 dev_warn(&serial->dev->dev, "Device Reported %d serial ports "
2766 __FUNCTION__, edge_serial->product_info.NumPorts, 2887 "vs. core thinking we have %d ports, email "
2767 serial->num_ports); 2888 "greg@kroah.com this information.",
2889 edge_serial->product_info.NumPorts,
2890 serial->num_ports);
2768 } 2891 }
2769 2892
2770 dbg("%s - time 1 %ld", __FUNCTION__, jiffies); 2893 dbg("%s - time 1 %ld", __FUNCTION__, jiffies);
2771 2894
2772 /* now load the application firmware into this device */ 2895 /* If not an EPiC device */
2773 load_application_firmware (edge_serial); 2896 if (!edge_serial->is_epic) {
2897 /* now load the application firmware into this device */
2898 load_application_firmware (edge_serial);
2774 2899
2775 dbg("%s - time 2 %ld", __FUNCTION__, jiffies); 2900 dbg("%s - time 2 %ld", __FUNCTION__, jiffies);
2776 2901
2777 /* Check current Edgeport EEPROM and update if necessary */ 2902 /* Check current Edgeport EEPROM and update if necessary */
2778 update_edgeport_E2PROM (edge_serial); 2903 update_edgeport_E2PROM (edge_serial);
2779
2780 dbg("%s - time 3 %ld", __FUNCTION__, jiffies);
2781 2904
2782 /* set the configuration to use #1 */ 2905 dbg("%s - time 3 %ld", __FUNCTION__, jiffies);
2783// dbg("set_configuration 1"); 2906
2784// usb_set_configuration (dev, 1); 2907 /* set the configuration to use #1 */
2908// dbg("set_configuration 1");
2909// usb_set_configuration (dev, 1);
2910 }
2785 2911
2786 /* we set up the pointers to the endpoints in the edge_open function, 2912 /* we set up the pointers to the endpoints in the edge_open function,
2787 * as the structures aren't created yet. */ 2913 * as the structures aren't created yet. */
@@ -2804,8 +2930,101 @@ static int edge_startup (struct usb_serial *serial)
2804 edge_port->port = serial->port[i]; 2930 edge_port->port = serial->port[i];
2805 usb_set_serial_port_data(serial->port[i], edge_port); 2931 usb_set_serial_port_data(serial->port[i], edge_port);
2806 } 2932 }
2807 2933
2808 return 0; 2934 response = 0;
2935
2936 if (edge_serial->is_epic) {
2937 /* EPIC thing, set up our interrupt polling now and our read urb, so
2938 * that the device knows it really is connected. */
2939 interrupt_in_found = bulk_in_found = bulk_out_found = FALSE;
2940 for (i = 0; i < serial->interface->altsetting[0].desc.bNumEndpoints; ++i) {
2941 struct usb_endpoint_descriptor *endpoint;
2942 int buffer_size;
2943
2944 endpoint = &serial->interface->altsetting[0].endpoint[i].desc;
2945 buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
2946 if ((!interrupt_in_found) &&
2947 (usb_endpoint_is_int_in(endpoint))) {
2948 /* we found a interrupt in endpoint */
2949 dbg("found interrupt in");
2950
2951 /* not set up yet, so do it now */
2952 edge_serial->interrupt_read_urb = usb_alloc_urb(0, GFP_KERNEL);
2953 if (!edge_serial->interrupt_read_urb) {
2954 err("out of memory");
2955 return -ENOMEM;
2956 }
2957 edge_serial->interrupt_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
2958 if (!edge_serial->interrupt_in_buffer) {
2959 err("out of memory");
2960 usb_free_urb(edge_serial->interrupt_read_urb);
2961 return -ENOMEM;
2962 }
2963 edge_serial->interrupt_in_endpoint = endpoint->bEndpointAddress;
2964
2965 /* set up our interrupt urb */
2966 usb_fill_int_urb(edge_serial->interrupt_read_urb,
2967 dev,
2968 usb_rcvintpipe(dev, endpoint->bEndpointAddress),
2969 edge_serial->interrupt_in_buffer,
2970 buffer_size,
2971 edge_interrupt_callback,
2972 edge_serial,
2973 endpoint->bInterval);
2974
2975 interrupt_in_found = TRUE;
2976 }
2977
2978 if ((!bulk_in_found) &&
2979 (usb_endpoint_is_bulk_in(endpoint))) {
2980 /* we found a bulk in endpoint */
2981 dbg("found bulk in");
2982
2983 /* not set up yet, so do it now */
2984 edge_serial->read_urb = usb_alloc_urb(0, GFP_KERNEL);
2985 if (!edge_serial->read_urb) {
2986 err("out of memory");
2987 return -ENOMEM;
2988 }
2989 edge_serial->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL);
2990 if (!edge_serial->bulk_in_buffer) {
2991 err ("out of memory");
2992 usb_free_urb(edge_serial->read_urb);
2993 return -ENOMEM;
2994 }
2995 edge_serial->bulk_in_endpoint = endpoint->bEndpointAddress;
2996
2997 /* set up our bulk in urb */
2998 usb_fill_bulk_urb(edge_serial->read_urb, dev,
2999 usb_rcvbulkpipe(dev, endpoint->bEndpointAddress),
3000 edge_serial->bulk_in_buffer,
3001 endpoint->wMaxPacketSize,
3002 edge_bulk_in_callback,
3003 edge_serial);
3004 bulk_in_found = TRUE;
3005 }
3006
3007 if ((!bulk_out_found) &&
3008 (usb_endpoint_is_bulk_out(endpoint))) {
3009 /* we found a bulk out endpoint */
3010 dbg("found bulk out");
3011 edge_serial->bulk_out_endpoint = endpoint->bEndpointAddress;
3012 bulk_out_found = TRUE;
3013 }
3014 }
3015
3016 if ((!interrupt_in_found) || (!bulk_in_found) || (!bulk_out_found)) {
3017 err ("Error - the proper endpoints were not found!");
3018 return -ENODEV;
3019 }
3020
3021 /* start interrupt read for this edgeport this interrupt will
3022 * continue as long as the edgeport is connected */
3023 response = usb_submit_urb(edge_serial->interrupt_read_urb, GFP_KERNEL);
3024 if (response)
3025 err("%s - Error %d submitting control urb", __FUNCTION__, response);
3026 }
3027 return response;
2809} 3028}
2810 3029
2811 3030
@@ -2815,6 +3034,7 @@ static int edge_startup (struct usb_serial *serial)
2815 ****************************************************************************/ 3034 ****************************************************************************/
2816static void edge_shutdown (struct usb_serial *serial) 3035static void edge_shutdown (struct usb_serial *serial)
2817{ 3036{
3037 struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
2818 int i; 3038 int i;
2819 3039
2820 dbg("%s", __FUNCTION__); 3040 dbg("%s", __FUNCTION__);
@@ -2824,7 +3044,18 @@ static void edge_shutdown (struct usb_serial *serial)
2824 kfree (usb_get_serial_port_data(serial->port[i])); 3044 kfree (usb_get_serial_port_data(serial->port[i]));
2825 usb_set_serial_port_data(serial->port[i], NULL); 3045 usb_set_serial_port_data(serial->port[i], NULL);
2826 } 3046 }
2827 kfree (usb_get_serial_data(serial)); 3047 /* free up our endpoint stuff */
3048 if (edge_serial->is_epic) {
3049 usb_unlink_urb(edge_serial->interrupt_read_urb);
3050 usb_free_urb(edge_serial->interrupt_read_urb);
3051 kfree(edge_serial->interrupt_in_buffer);
3052
3053 usb_unlink_urb(edge_serial->read_urb);
3054 usb_free_urb(edge_serial->read_urb);
3055 kfree(edge_serial->bulk_in_buffer);
3056 }
3057
3058 kfree(edge_serial);
2828 usb_set_serial_data(serial, NULL); 3059 usb_set_serial_data(serial, NULL);
2829} 3060}
2830 3061
@@ -2846,6 +3077,9 @@ static int __init edgeport_init(void)
2846 retval = usb_serial_register(&edgeport_8port_device); 3077 retval = usb_serial_register(&edgeport_8port_device);
2847 if (retval) 3078 if (retval)
2848 goto failed_8port_device_register; 3079 goto failed_8port_device_register;
3080 retval = usb_serial_register(&epic_device);
3081 if (retval)
3082 goto failed_epic_device_register;
2849 retval = usb_register(&io_driver); 3083 retval = usb_register(&io_driver);
2850 if (retval) 3084 if (retval)
2851 goto failed_usb_register; 3085 goto failed_usb_register;
@@ -2853,6 +3087,8 @@ static int __init edgeport_init(void)
2853 return 0; 3087 return 0;
2854 3088
2855failed_usb_register: 3089failed_usb_register:
3090 usb_serial_deregister(&epic_device);
3091failed_epic_device_register:
2856 usb_serial_deregister(&edgeport_8port_device); 3092 usb_serial_deregister(&edgeport_8port_device);
2857failed_8port_device_register: 3093failed_8port_device_register:
2858 usb_serial_deregister(&edgeport_4port_device); 3094 usb_serial_deregister(&edgeport_4port_device);
@@ -2873,6 +3109,7 @@ static void __exit edgeport_exit (void)
2873 usb_serial_deregister (&edgeport_2port_device); 3109 usb_serial_deregister (&edgeport_2port_device);
2874 usb_serial_deregister (&edgeport_4port_device); 3110 usb_serial_deregister (&edgeport_4port_device);
2875 usb_serial_deregister (&edgeport_8port_device); 3111 usb_serial_deregister (&edgeport_8port_device);
3112 usb_serial_deregister (&epic_device);
2876} 3113}
2877 3114
2878module_init(edgeport_init); 3115module_init(edgeport_init);
diff --git a/drivers/usb/serial/io_edgeport.h b/drivers/usb/serial/io_edgeport.h
index 123fa8a904e6..29a913a6daca 100644
--- a/drivers/usb/serial/io_edgeport.h
+++ b/drivers/usb/serial/io_edgeport.h
@@ -111,10 +111,12 @@ struct edgeport_product_info {
111 __le16 FirmwareBuildNumber; /* zzzz (LE format) */ 111 __le16 FirmwareBuildNumber; /* zzzz (LE format) */
112 112
113 __u8 ManufactureDescDate[3]; /* MM/DD/YY when descriptor template was compiled */ 113 __u8 ManufactureDescDate[3]; /* MM/DD/YY when descriptor template was compiled */
114 __u8 Unused1[1]; /* Available */ 114 __u8 HardwareType;
115 115
116 __u8 iDownloadFile; /* What to download to EPiC device */ 116 __u8 iDownloadFile; /* What to download to EPiC device */
117 __u8 Unused2[2]; /* Available */ 117 __u8 EpicVer; /* What version of EPiC spec this device supports */
118
119 struct edge_compatibility_bits Epic;
118}; 120};
119 121
120/* 122/*
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
index fad561c04c76..6d3008772540 100644
--- a/drivers/usb/serial/io_tables.h
+++ b/drivers/usb/serial/io_tables.h
@@ -47,6 +47,18 @@ static struct usb_device_id edgeport_8port_id_table [] = {
47 { } 47 { }
48}; 48};
49 49
50static struct usb_device_id Epic_port_id_table [] = {
51 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0202) },
52 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0203) },
53 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0310) },
54 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0311) },
55 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0312) },
56 { USB_DEVICE(USB_VENDOR_ID_AXIOHM, AXIOHM_DEVICE_ID_EPIC_A758) },
57 { USB_DEVICE(USB_VENDOR_ID_AXIOHM, AXIOHM_DEVICE_ID_EPIC_A794) },
58 { USB_DEVICE(USB_VENDOR_ID_AXIOHM, AXIOHM_DEVICE_ID_EPIC_A225) },
59 { }
60};
61
50/* Devices that this driver supports */ 62/* Devices that this driver supports */
51static struct usb_device_id id_table_combined [] = { 63static struct usb_device_id id_table_combined [] = {
52 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_4) }, 64 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_4) },
@@ -70,17 +82,34 @@ static struct usb_device_id id_table_combined [] = {
70 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_8R) }, 82 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_8R) },
71 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_8RR) }, 83 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_8RR) },
72 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_412_8) }, 84 { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_EDGEPORT_412_8) },
85 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0202) },
86 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0203) },
87 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0310) },
88 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0311) },
89 { USB_DEVICE(USB_VENDOR_ID_NCR, NCR_DEVICE_ID_EPIC_0312) },
90 { USB_DEVICE(USB_VENDOR_ID_AXIOHM, AXIOHM_DEVICE_ID_EPIC_A758) },
91 { USB_DEVICE(USB_VENDOR_ID_AXIOHM, AXIOHM_DEVICE_ID_EPIC_A794) },
92 { USB_DEVICE(USB_VENDOR_ID_AXIOHM, AXIOHM_DEVICE_ID_EPIC_A225) },
73 { } /* Terminating entry */ 93 { } /* Terminating entry */
74}; 94};
75 95
76MODULE_DEVICE_TABLE (usb, id_table_combined); 96MODULE_DEVICE_TABLE (usb, id_table_combined);
77 97
98static struct usb_driver io_driver = {
99 .name = "io_edgeport",
100 .probe = usb_serial_probe,
101 .disconnect = usb_serial_disconnect,
102 .id_table = id_table_combined,
103 .no_dynamic_id = 1,
104};
105
78static struct usb_serial_driver edgeport_2port_device = { 106static struct usb_serial_driver edgeport_2port_device = {
79 .driver = { 107 .driver = {
80 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,
81 .name = "edgeport_2", 109 .name = "edgeport_2",
82 }, 110 },
83 .description = "Edgeport 2 port adapter", 111 .description = "Edgeport 2 port adapter",
112 .usb_driver = &io_driver,
84 .id_table = edgeport_2port_id_table, 113 .id_table = edgeport_2port_id_table,
85 .num_interrupt_in = 1, 114 .num_interrupt_in = 1,
86 .num_bulk_in = 1, 115 .num_bulk_in = 1,
@@ -111,6 +140,7 @@ static struct usb_serial_driver edgeport_4port_device = {
111 .name = "edgeport_4", 140 .name = "edgeport_4",
112 }, 141 },
113 .description = "Edgeport 4 port adapter", 142 .description = "Edgeport 4 port adapter",
143 .usb_driver = &io_driver,
114 .id_table = edgeport_4port_id_table, 144 .id_table = edgeport_4port_id_table,
115 .num_interrupt_in = 1, 145 .num_interrupt_in = 1,
116 .num_bulk_in = 1, 146 .num_bulk_in = 1,
@@ -141,6 +171,7 @@ static struct usb_serial_driver edgeport_8port_device = {
141 .name = "edgeport_8", 171 .name = "edgeport_8",
142 }, 172 },
143 .description = "Edgeport 8 port adapter", 173 .description = "Edgeport 8 port adapter",
174 .usb_driver = &io_driver,
144 .id_table = edgeport_8port_id_table, 175 .id_table = edgeport_8port_id_table,
145 .num_interrupt_in = 1, 176 .num_interrupt_in = 1,
146 .num_bulk_in = 1, 177 .num_bulk_in = 1,
@@ -165,5 +196,35 @@ static struct usb_serial_driver edgeport_8port_device = {
165 .write_bulk_callback = edge_bulk_out_data_callback, 196 .write_bulk_callback = edge_bulk_out_data_callback,
166}; 197};
167 198
199static struct usb_serial_driver epic_device = {
200 .driver = {
201 .owner = THIS_MODULE,
202 .name = "epic",
203 },
204 .description = "EPiC device",
205 .id_table = Epic_port_id_table,
206 .num_interrupt_in = 1,
207 .num_bulk_in = 1,
208 .num_bulk_out = 1,
209 .num_ports = 1,
210 .open = edge_open,
211 .close = edge_close,
212 .throttle = edge_throttle,
213 .unthrottle = edge_unthrottle,
214 .attach = edge_startup,
215 .shutdown = edge_shutdown,
216 .ioctl = edge_ioctl,
217 .set_termios = edge_set_termios,
218 .tiocmget = edge_tiocmget,
219 .tiocmset = edge_tiocmset,
220 .write = edge_write,
221 .write_room = edge_write_room,
222 .chars_in_buffer = edge_chars_in_buffer,
223 .break_ctl = edge_break,
224 .read_int_callback = edge_interrupt_callback,
225 .read_bulk_callback = edge_bulk_in_callback,
226 .write_bulk_callback = edge_bulk_out_data_callback,
227};
228
168#endif 229#endif
169 230
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index ee0c921e1520..544098d2b775 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -238,7 +238,7 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned c
238static void stop_read(struct edgeport_port *edge_port); 238static void stop_read(struct edgeport_port *edge_port);
239static int restart_read(struct edgeport_port *edge_port); 239static int restart_read(struct edgeport_port *edge_port);
240 240
241static void edge_set_termios (struct usb_serial_port *port, struct termios *old_termios); 241static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios);
242static void edge_send(struct usb_serial_port *port); 242static void edge_send(struct usb_serial_port *port);
243 243
244/* circular buffer */ 244/* circular buffer */
@@ -2361,7 +2361,7 @@ static int restart_read(struct edgeport_port *edge_port)
2361 return status; 2361 return status;
2362} 2362}
2363 2363
2364static void change_port_settings (struct edgeport_port *edge_port, struct termios *old_termios) 2364static void change_port_settings (struct edgeport_port *edge_port, struct ktermios *old_termios)
2365{ 2365{
2366 struct ump_uart_config *config; 2366 struct ump_uart_config *config;
2367 struct tty_struct *tty; 2367 struct tty_struct *tty;
@@ -2512,7 +2512,7 @@ static void change_port_settings (struct edgeport_port *edge_port, struct termio
2512 return; 2512 return;
2513} 2513}
2514 2514
2515static void edge_set_termios (struct usb_serial_port *port, struct termios *old_termios) 2515static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
2516{ 2516{
2517 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 2517 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2518 struct tty_struct *tty = port->tty; 2518 struct tty_struct *tty = port->tty;
@@ -2811,7 +2811,7 @@ static struct edge_buf *edge_buf_alloc(unsigned int size)
2811 if (size == 0) 2811 if (size == 0)
2812 return NULL; 2812 return NULL;
2813 2813
2814 eb = (struct edge_buf *)kmalloc(sizeof(struct edge_buf), GFP_KERNEL); 2814 eb = kmalloc(sizeof(struct edge_buf), GFP_KERNEL);
2815 if (eb == NULL) 2815 if (eb == NULL)
2816 return NULL; 2816 return NULL;
2817 2817
@@ -2979,6 +2979,7 @@ static struct usb_serial_driver edgeport_1port_device = {
2979 .name = "edgeport_ti_1", 2979 .name = "edgeport_ti_1",
2980 }, 2980 },
2981 .description = "Edgeport TI 1 port adapter", 2981 .description = "Edgeport TI 1 port adapter",
2982 .usb_driver = &io_driver,
2982 .id_table = edgeport_1port_id_table, 2983 .id_table = edgeport_1port_id_table,
2983 .num_interrupt_in = 1, 2984 .num_interrupt_in = 1,
2984 .num_bulk_in = 1, 2985 .num_bulk_in = 1,
@@ -3009,6 +3010,7 @@ static struct usb_serial_driver edgeport_2port_device = {
3009 .name = "edgeport_ti_2", 3010 .name = "edgeport_ti_2",
3010 }, 3011 },
3011 .description = "Edgeport TI 2 port adapter", 3012 .description = "Edgeport TI 2 port adapter",
3013 .usb_driver = &io_driver,
3012 .id_table = edgeport_2port_id_table, 3014 .id_table = edgeport_2port_id_table,
3013 .num_interrupt_in = 1, 3015 .num_interrupt_in = 1,
3014 .num_bulk_in = 2, 3016 .num_bulk_in = 2,
diff --git a/drivers/usb/serial/io_usbvend.h b/drivers/usb/serial/io_usbvend.h
index f1804fd5a3dd..e57fa117e486 100644
--- a/drivers/usb/serial/io_usbvend.h
+++ b/drivers/usb/serial/io_usbvend.h
@@ -30,6 +30,7 @@
30 30
31#define USB_VENDOR_ID_ION 0x1608 // Our VID 31#define USB_VENDOR_ID_ION 0x1608 // Our VID
32#define USB_VENDOR_ID_TI 0x0451 // TI VID 32#define USB_VENDOR_ID_TI 0x0451 // TI VID
33#define USB_VENDOR_ID_AXIOHM 0x05D9 /* Axiohm VID */
33 34
34// 35//
35// Definitions of USB product IDs (PID) 36// Definitions of USB product IDs (PID)
@@ -334,6 +335,10 @@ struct edge_compatibility_bits
334 335
335}; 336};
336 337
338#define EDGE_COMPATIBILITY_MASK0 0x0001
339#define EDGE_COMPATIBILITY_MASK1 0x3FFF
340#define EDGE_COMPATIBILITY_MASK2 0x0001
341
337struct edge_compatibility_descriptor 342struct edge_compatibility_descriptor
338{ 343{
339 __u8 Length; // Descriptor Length (per USB spec) 344 __u8 Length; // Descriptor Length (per USB spec)
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index d72cf8bc7f76..a408184334ea 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -563,6 +563,7 @@ static struct usb_serial_driver ipaq_device = {
563 .name = "ipaq", 563 .name = "ipaq",
564 }, 564 },
565 .description = "PocketPC PDA", 565 .description = "PocketPC PDA",
566 .usb_driver = &ipaq_driver,
566 .id_table = ipaq_id_table, 567 .id_table = ipaq_id_table,
567 .num_interrupt_in = NUM_DONT_CARE, 568 .num_interrupt_in = NUM_DONT_CARE,
568 .num_bulk_in = 1, 569 .num_bulk_in = 1,
@@ -595,7 +596,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
595 596
596 bytes_in = 0; 597 bytes_in = 0;
597 bytes_out = 0; 598 bytes_out = 0;
598 priv = (struct ipaq_private *)kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); 599 priv = kmalloc(sizeof(struct ipaq_private), GFP_KERNEL);
599 if (priv == NULL) { 600 if (priv == NULL) {
600 err("%s - Out of memory", __FUNCTION__); 601 err("%s - Out of memory", __FUNCTION__);
601 return -ENOMEM; 602 return -ENOMEM;
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index d3b9a351cef8..1bc586064c77 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -442,6 +442,7 @@ static struct usb_serial_driver ipw_device = {
442 .name = "ipw", 442 .name = "ipw",
443 }, 443 },
444 .description = "IPWireless converter", 444 .description = "IPWireless converter",
445 .usb_driver = &usb_ipw_driver,
445 .id_table = usb_ipw_ids, 446 .id_table = usb_ipw_ids,
446 .num_interrupt_in = NUM_DONT_CARE, 447 .num_interrupt_in = NUM_DONT_CARE,
447 .num_bulk_in = 1, 448 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index 331bf81556fc..9d847f69291c 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -107,7 +107,7 @@ static void ir_close (struct usb_serial_port *port, struct file *filep);
107static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int count); 107static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int count);
108static void ir_write_bulk_callback (struct urb *urb); 108static void ir_write_bulk_callback (struct urb *urb);
109static void ir_read_bulk_callback (struct urb *urb); 109static void ir_read_bulk_callback (struct urb *urb);
110static void ir_set_termios (struct usb_serial_port *port, struct termios *old_termios); 110static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_termios);
111 111
112static u8 ir_baud = 0; 112static u8 ir_baud = 0;
113static u8 ir_xbof = 0; 113static u8 ir_xbof = 0;
@@ -138,6 +138,7 @@ static struct usb_serial_driver ir_device = {
138 .name = "ir-usb", 138 .name = "ir-usb",
139 }, 139 },
140 .description = "IR Dongle", 140 .description = "IR Dongle",
141 .usb_driver = &ir_driver,
141 .id_table = id_table, 142 .id_table = id_table,
142 .num_interrupt_in = 1, 143 .num_interrupt_in = 1,
143 .num_bulk_in = 1, 144 .num_bulk_in = 1,
@@ -497,7 +498,7 @@ static void ir_read_bulk_callback (struct urb *urb)
497 return; 498 return;
498} 499}
499 500
500static void ir_set_termios (struct usb_serial_port *port, struct termios *old_termios) 501static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
501{ 502{
502 unsigned char *transfer_buffer; 503 unsigned char *transfer_buffer;
503 unsigned int cflag; 504 unsigned int cflag;
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 7639652cec42..e6966f12ed5a 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -264,7 +264,7 @@ static void keyspan_break_ctl (struct usb_serial_port *port, int break_state)
264 264
265 265
266static void keyspan_set_termios (struct usb_serial_port *port, 266static void keyspan_set_termios (struct usb_serial_port *port,
267 struct termios *old_termios) 267 struct ktermios *old_termios)
268{ 268{
269 int baud_rate, device_port; 269 int baud_rate, device_port;
270 struct keyspan_port_private *p_priv; 270 struct keyspan_port_private *p_priv;
@@ -1275,11 +1275,31 @@ static int keyspan_fake_startup (struct usb_serial *serial)
1275} 1275}
1276 1276
1277/* Helper functions used by keyspan_setup_urbs */ 1277/* Helper functions used by keyspan_setup_urbs */
1278static struct usb_endpoint_descriptor const *find_ep(struct usb_serial const *serial,
1279 int endpoint)
1280{
1281 struct usb_host_interface *iface_desc;
1282 struct usb_endpoint_descriptor *ep;
1283 int i;
1284
1285 iface_desc = serial->interface->cur_altsetting;
1286 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
1287 ep = &iface_desc->endpoint[i].desc;
1288 if (ep->bEndpointAddress == endpoint)
1289 return ep;
1290 }
1291 dev_warn(&serial->interface->dev, "found no endpoint descriptor for "
1292 "endpoint %x\n", endpoint);
1293 return NULL;
1294}
1295
1278static struct urb *keyspan_setup_urb (struct usb_serial *serial, int endpoint, 1296static struct urb *keyspan_setup_urb (struct usb_serial *serial, int endpoint,
1279 int dir, void *ctx, char *buf, int len, 1297 int dir, void *ctx, char *buf, int len,
1280 void (*callback)(struct urb *)) 1298 void (*callback)(struct urb *))
1281{ 1299{
1282 struct urb *urb; 1300 struct urb *urb;
1301 struct usb_endpoint_descriptor const *ep_desc;
1302 char const *ep_type_name;
1283 1303
1284 if (endpoint == -1) 1304 if (endpoint == -1)
1285 return NULL; /* endpoint not needed */ 1305 return NULL; /* endpoint not needed */
@@ -1291,11 +1311,32 @@ static struct urb *keyspan_setup_urb (struct usb_serial *serial, int endpoint,
1291 return NULL; 1311 return NULL;
1292 } 1312 }
1293 1313
1294 /* Fill URB using supplied data. */ 1314 ep_desc = find_ep(serial, endpoint);
1295 usb_fill_bulk_urb(urb, serial->dev, 1315 if (!ep_desc) {
1296 usb_sndbulkpipe(serial->dev, endpoint) | dir, 1316 /* leak the urb, something's wrong and the callers don't care */
1297 buf, len, callback, ctx); 1317 return urb;
1318 }
1319 if (usb_endpoint_xfer_int(ep_desc)) {
1320 ep_type_name = "INT";
1321 usb_fill_int_urb(urb, serial->dev,
1322 usb_sndintpipe(serial->dev, endpoint) | dir,
1323 buf, len, callback, ctx,
1324 ep_desc->bInterval);
1325 } else if (usb_endpoint_xfer_bulk(ep_desc)) {
1326 ep_type_name = "BULK";
1327 usb_fill_bulk_urb(urb, serial->dev,
1328 usb_sndbulkpipe(serial->dev, endpoint) | dir,
1329 buf, len, callback, ctx);
1330 } else {
1331 dev_warn(&serial->interface->dev,
1332 "unsupported endpoint type %x\n",
1333 ep_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK);
1334 usb_free_urb(urb);
1335 return NULL;
1336 }
1298 1337
1338 dbg("%s - using urb %p for %s endpoint %x",
1339 __func__, urb, ep_type_name, endpoint);
1299 return urb; 1340 return urb;
1300} 1341}
1301 1342
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index 7472ed6bf626..c6830cbdc6df 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -59,7 +59,7 @@ static int keyspan_ioctl (struct usb_serial_port *port,
59 unsigned int cmd, 59 unsigned int cmd,
60 unsigned long arg); 60 unsigned long arg);
61static void keyspan_set_termios (struct usb_serial_port *port, 61static void keyspan_set_termios (struct usb_serial_port *port,
62 struct termios *old); 62 struct ktermios *old);
63static void keyspan_break_ctl (struct usb_serial_port *port, 63static void keyspan_break_ctl (struct usb_serial_port *port,
64 int break_state); 64 int break_state);
65static int keyspan_tiocmget (struct usb_serial_port *port, 65static int keyspan_tiocmget (struct usb_serial_port *port,
@@ -229,7 +229,6 @@ struct ezusb_hex_record {
229#define keyspan_usa28_product_id 0x010f 229#define keyspan_usa28_product_id 0x010f
230#define keyspan_usa28x_product_id 0x0110 230#define keyspan_usa28x_product_id 0x0110
231#define keyspan_usa28xa_product_id 0x0115 231#define keyspan_usa28xa_product_id 0x0115
232#define keyspan_usa28xb_product_id 0x0110
233#define keyspan_usa49w_product_id 0x010a 232#define keyspan_usa49w_product_id 0x010a
234#define keyspan_usa49wlc_product_id 0x012a 233#define keyspan_usa49wlc_product_id 0x012a
235 234
@@ -511,7 +510,6 @@ static struct usb_device_id keyspan_ids_combined[] = {
511 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) }, 510 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
512 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) }, 511 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
513 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) }, 512 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
514 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_product_id) },
515 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id)}, 513 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id)},
516 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)}, 514 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49wlc_product_id)},
517 { } /* Terminating entry */ 515 { } /* Terminating entry */
@@ -559,7 +557,6 @@ static struct usb_device_id keyspan_2port_ids[] = {
559 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) }, 557 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
560 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) }, 558 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
561 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) }, 559 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
562 { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_product_id) },
563 { } /* Terminating entry */ 560 { } /* Terminating entry */
564}; 561};
565 562
@@ -576,6 +573,7 @@ static struct usb_serial_driver keyspan_pre_device = {
576 .name = "keyspan_no_firm", 573 .name = "keyspan_no_firm",
577 }, 574 },
578 .description = "Keyspan - (without firmware)", 575 .description = "Keyspan - (without firmware)",
576 .usb_driver = &keyspan_driver,
579 .id_table = keyspan_pre_ids, 577 .id_table = keyspan_pre_ids,
580 .num_interrupt_in = NUM_DONT_CARE, 578 .num_interrupt_in = NUM_DONT_CARE,
581 .num_bulk_in = NUM_DONT_CARE, 579 .num_bulk_in = NUM_DONT_CARE,
@@ -590,6 +588,7 @@ static struct usb_serial_driver keyspan_1port_device = {
590 .name = "keyspan_1", 588 .name = "keyspan_1",
591 }, 589 },
592 .description = "Keyspan 1 port adapter", 590 .description = "Keyspan 1 port adapter",
591 .usb_driver = &keyspan_driver,
593 .id_table = keyspan_1port_ids, 592 .id_table = keyspan_1port_ids,
594 .num_interrupt_in = NUM_DONT_CARE, 593 .num_interrupt_in = NUM_DONT_CARE,
595 .num_bulk_in = NUM_DONT_CARE, 594 .num_bulk_in = NUM_DONT_CARE,
@@ -617,6 +616,7 @@ static struct usb_serial_driver keyspan_2port_device = {
617 .name = "keyspan_2", 616 .name = "keyspan_2",
618 }, 617 },
619 .description = "Keyspan 2 port adapter", 618 .description = "Keyspan 2 port adapter",
619 .usb_driver = &keyspan_driver,
620 .id_table = keyspan_2port_ids, 620 .id_table = keyspan_2port_ids,
621 .num_interrupt_in = NUM_DONT_CARE, 621 .num_interrupt_in = NUM_DONT_CARE,
622 .num_bulk_in = NUM_DONT_CARE, 622 .num_bulk_in = NUM_DONT_CARE,
@@ -644,6 +644,7 @@ static struct usb_serial_driver keyspan_4port_device = {
644 .name = "keyspan_4", 644 .name = "keyspan_4",
645 }, 645 },
646 .description = "Keyspan 4 port adapter", 646 .description = "Keyspan 4 port adapter",
647 .usb_driver = &keyspan_driver,
647 .id_table = keyspan_4port_ids, 648 .id_table = keyspan_4port_ids,
648 .num_interrupt_in = NUM_DONT_CARE, 649 .num_interrupt_in = NUM_DONT_CARE,
649 .num_bulk_in = 5, 650 .num_bulk_in = 5,
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index e09a0bfe6231..da514cb785b3 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -365,7 +365,7 @@ static void keyspan_pda_break_ctl (struct usb_serial_port *port, int break_state
365 365
366 366
367static void keyspan_pda_set_termios (struct usb_serial_port *port, 367static void keyspan_pda_set_termios (struct usb_serial_port *port,
368 struct termios *old_termios) 368 struct ktermios *old_termios)
369{ 369{
370 struct usb_serial *serial = port->serial; 370 struct usb_serial *serial = port->serial;
371 unsigned int cflag = port->tty->termios->c_cflag; 371 unsigned int cflag = port->tty->termios->c_cflag;
@@ -793,6 +793,7 @@ static struct usb_serial_driver keyspan_pda_fake_device = {
793 .name = "keyspan_pda_pre", 793 .name = "keyspan_pda_pre",
794 }, 794 },
795 .description = "Keyspan PDA - (prerenumeration)", 795 .description = "Keyspan PDA - (prerenumeration)",
796 .usb_driver = &keyspan_pda_driver,
796 .id_table = id_table_fake, 797 .id_table = id_table_fake,
797 .num_interrupt_in = NUM_DONT_CARE, 798 .num_interrupt_in = NUM_DONT_CARE,
798 .num_bulk_in = NUM_DONT_CARE, 799 .num_bulk_in = NUM_DONT_CARE,
@@ -809,6 +810,7 @@ static struct usb_serial_driver xircom_pgs_fake_device = {
809 .name = "xircom_no_firm", 810 .name = "xircom_no_firm",
810 }, 811 },
811 .description = "Xircom / Entregra PGS - (prerenumeration)", 812 .description = "Xircom / Entregra PGS - (prerenumeration)",
813 .usb_driver = &keyspan_pda_driver,
812 .id_table = id_table_fake_xircom, 814 .id_table = id_table_fake_xircom,
813 .num_interrupt_in = NUM_DONT_CARE, 815 .num_interrupt_in = NUM_DONT_CARE,
814 .num_bulk_in = NUM_DONT_CARE, 816 .num_bulk_in = NUM_DONT_CARE,
@@ -824,6 +826,7 @@ static struct usb_serial_driver keyspan_pda_device = {
824 .name = "keyspan_pda", 826 .name = "keyspan_pda",
825 }, 827 },
826 .description = "Keyspan PDA", 828 .description = "Keyspan PDA",
829 .usb_driver = &keyspan_pda_driver,
827 .id_table = id_table_std, 830 .id_table = id_table_std,
828 .num_interrupt_in = 1, 831 .num_interrupt_in = 1,
829 .num_bulk_in = 0, 832 .num_bulk_in = 0,
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 17e205699c2b..b2097c45a235 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -86,11 +86,7 @@ static int klsi_105_write_room (struct usb_serial_port *port);
86 86
87static void klsi_105_read_bulk_callback (struct urb *urb); 87static void klsi_105_read_bulk_callback (struct urb *urb);
88static void klsi_105_set_termios (struct usb_serial_port *port, 88static void klsi_105_set_termios (struct usb_serial_port *port,
89 struct termios * old); 89 struct ktermios *old);
90static int klsi_105_ioctl (struct usb_serial_port *port,
91 struct file * file,
92 unsigned int cmd,
93 unsigned long arg);
94static void klsi_105_throttle (struct usb_serial_port *port); 90static void klsi_105_throttle (struct usb_serial_port *port);
95static void klsi_105_unthrottle (struct usb_serial_port *port); 91static void klsi_105_unthrottle (struct usb_serial_port *port);
96/* 92/*
@@ -128,6 +124,7 @@ static struct usb_serial_driver kl5kusb105d_device = {
128 .name = "kl5kusb105d", 124 .name = "kl5kusb105d",
129 }, 125 },
130 .description = "KL5KUSB105D / PalmConnect", 126 .description = "KL5KUSB105D / PalmConnect",
127 .usb_driver = &kl5kusb105d_driver,
131 .id_table = id_table, 128 .id_table = id_table,
132 .num_interrupt_in = 1, 129 .num_interrupt_in = 1,
133 .num_bulk_in = 1, 130 .num_bulk_in = 1,
@@ -140,7 +137,6 @@ static struct usb_serial_driver kl5kusb105d_device = {
140 .chars_in_buffer = klsi_105_chars_in_buffer, 137 .chars_in_buffer = klsi_105_chars_in_buffer,
141 .write_room = klsi_105_write_room, 138 .write_room = klsi_105_write_room,
142 .read_bulk_callback =klsi_105_read_bulk_callback, 139 .read_bulk_callback =klsi_105_read_bulk_callback,
143 .ioctl = klsi_105_ioctl,
144 .set_termios = klsi_105_set_termios, 140 .set_termios = klsi_105_set_termios,
145 /*.break_ctl = klsi_105_break_ctl,*/ 141 /*.break_ctl = klsi_105_break_ctl,*/
146 .tiocmget = klsi_105_tiocmget, 142 .tiocmget = klsi_105_tiocmget,
@@ -164,7 +160,7 @@ struct klsi_105_port_settings {
164#define URB_TRANSFER_BUFFER_SIZE 64 160#define URB_TRANSFER_BUFFER_SIZE 64
165struct klsi_105_private { 161struct klsi_105_private {
166 struct klsi_105_port_settings cfg; 162 struct klsi_105_port_settings cfg;
167 struct termios termios; 163 struct ktermios termios;
168 unsigned long line_state; /* modem line settings */ 164 unsigned long line_state; /* modem line settings */
169 /* write pool */ 165 /* write pool */
170 struct urb * write_urb_pool[NUM_URBS]; 166 struct urb * write_urb_pool[NUM_URBS];
@@ -688,7 +684,7 @@ static void klsi_105_read_bulk_callback (struct urb *urb)
688 684
689 685
690static void klsi_105_set_termios (struct usb_serial_port *port, 686static void klsi_105_set_termios (struct usb_serial_port *port,
691 struct termios *old_termios) 687 struct ktermios *old_termios)
692{ 688{
693 struct klsi_105_private *priv = usb_get_serial_port_data(port); 689 struct klsi_105_private *priv = usb_get_serial_port_data(port);
694 unsigned int iflag = port->tty->termios->c_iflag; 690 unsigned int iflag = port->tty->termios->c_iflag;
@@ -899,69 +895,6 @@ static int klsi_105_tiocmset (struct usb_serial_port *port, struct file *file,
899*/ 895*/
900 return retval; 896 return retval;
901} 897}
902
903static int klsi_105_ioctl (struct usb_serial_port *port, struct file * file,
904 unsigned int cmd, unsigned long arg)
905{
906 struct klsi_105_private *priv = usb_get_serial_port_data(port);
907 void __user *user_arg = (void __user *)arg;
908
909 dbg("%scmd=0x%x", __FUNCTION__, cmd);
910
911 /* Based on code from acm.c and others */
912 switch (cmd) {
913 case TIOCMIWAIT:
914 /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/
915 /* TODO */
916 dbg("%s - TIOCMIWAIT not handled", __FUNCTION__);
917 return -ENOIOCTLCMD;
918 case TIOCGICOUNT:
919 /* return count of modemline transitions */
920 /* TODO */
921 dbg("%s - TIOCGICOUNT not handled", __FUNCTION__);
922 return -ENOIOCTLCMD;
923 case TCGETS:
924 /* return current info to caller */
925 dbg("%s - TCGETS data faked/incomplete", __FUNCTION__);
926
927 if (!access_ok(VERIFY_WRITE, user_arg, sizeof(struct termios)))
928 return -EFAULT;
929
930 if (kernel_termios_to_user_termios((struct termios __user *)arg,
931 &priv->termios))
932 return -EFAULT;
933 return 0;
934 case TCSETS:
935 /* set port termios to the one given by the user */
936 dbg("%s - TCSETS not handled", __FUNCTION__);
937
938 if (!access_ok(VERIFY_READ, user_arg, sizeof(struct termios)))
939 return -EFAULT;
940
941 if (user_termios_to_kernel_termios(&priv->termios,
942 (struct termios __user *)arg))
943 return -EFAULT;
944 klsi_105_set_termios(port, &priv->termios);
945 return 0;
946 case TCSETSW: {
947 /* set port termios and try to wait for completion of last
948 * write operation */
949 /* We guess here. If there are not too many write urbs
950 * outstanding, we lie. */
951 /* what is the right way to wait here? schedule() ? */
952 /*
953 while (klsi_105_chars_in_buffer(port) > (NUM_URBS / 4 ) * URB_TRANSFER_BUFFER_SIZE)
954 schedule();
955 */
956 return -ENOIOCTLCMD;
957 }
958 default:
959 dbg("%s: arg not supported - 0x%04x", __FUNCTION__,cmd);
960 return(-ENOIOCTLCMD);
961 break;
962 }
963 return 0;
964} /* klsi_105_ioctl */
965 898
966static void klsi_105_throttle (struct usb_serial_port *port) 899static void klsi_105_throttle (struct usb_serial_port *port)
967{ 900{
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 237289920f03..0683b51f0932 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -110,6 +110,7 @@ static struct usb_serial_driver kobil_device = {
110 .name = "kobil", 110 .name = "kobil",
111 }, 111 },
112 .description = "KOBIL USB smart card terminal", 112 .description = "KOBIL USB smart card terminal",
113 .usb_driver = &kobil_driver,
113 .id_table = id_table, 114 .id_table = id_table,
114 .num_interrupt_in = NUM_DONT_CARE, 115 .num_interrupt_in = NUM_DONT_CARE,
115 .num_bulk_in = 0, 116 .num_bulk_in = 0,
@@ -136,7 +137,7 @@ struct kobil_private {
136 int cur_pos; // index of the next char to send in buf 137 int cur_pos; // index of the next char to send in buf
137 __u16 device_type; 138 __u16 device_type;
138 int line_state; 139 int line_state;
139 struct termios internal_termios; 140 struct ktermios internal_termios;
140}; 141};
141 142
142 143
@@ -269,7 +270,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
269 } 270 }
270 271
271 // allocate memory for write_urb transfer buffer 272 // allocate memory for write_urb transfer buffer
272 port->write_urb->transfer_buffer = (unsigned char *) kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL); 273 port->write_urb->transfer_buffer = kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL);
273 if (! port->write_urb->transfer_buffer) { 274 if (! port->write_urb->transfer_buffer) {
274 kfree(transfer_buffer); 275 kfree(transfer_buffer);
275 usb_free_urb(port->write_urb); 276 usb_free_urb(port->write_urb);
@@ -624,11 +625,11 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
624 625
625 switch (cmd) { 626 switch (cmd) {
626 case TCGETS: // 0x5401 627 case TCGETS: // 0x5401
627 if (!access_ok(VERIFY_WRITE, user_arg, sizeof(struct termios))) { 628 if (!access_ok(VERIFY_WRITE, user_arg, sizeof(struct ktermios))) {
628 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number); 629 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number);
629 return -EFAULT; 630 return -EFAULT;
630 } 631 }
631 if (kernel_termios_to_user_termios((struct termios __user *)arg, 632 if (kernel_termios_to_user_termios((struct ktermios __user *)arg,
632 &priv->internal_termios)) 633 &priv->internal_termios))
633 return -EFAULT; 634 return -EFAULT;
634 return 0; 635 return 0;
@@ -638,12 +639,12 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
638 dbg("%s - port %d Error: port->tty->termios is NULL", __FUNCTION__, port->number); 639 dbg("%s - port %d Error: port->tty->termios is NULL", __FUNCTION__, port->number);
639 return -ENOTTY; 640 return -ENOTTY;
640 } 641 }
641 if (!access_ok(VERIFY_READ, user_arg, sizeof(struct termios))) { 642 if (!access_ok(VERIFY_READ, user_arg, sizeof(struct ktermios))) {
642 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number); 643 dbg("%s - port %d Error in access_ok", __FUNCTION__, port->number);
643 return -EFAULT; 644 return -EFAULT;
644 } 645 }
645 if (user_termios_to_kernel_termios(&priv->internal_termios, 646 if (user_termios_to_kernel_termios(&priv->internal_termios,
646 (struct termios __user *)arg)) 647 (struct ktermios __user *)arg))
647 return -EFAULT; 648 return -EFAULT;
648 649
649 settings = kzalloc(50, GFP_KERNEL); 650 settings = kzalloc(50, GFP_KERNEL);
@@ -696,7 +697,7 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file *file,
696 return 0; 697 return 0;
697 698
698 case TCFLSH: // 0x540B 699 case TCFLSH: // 0x540B
699 transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); 700 transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL);
700 if (! transfer_buffer) { 701 if (! transfer_buffer) {
701 return -ENOBUFS; 702 return -ENOBUFS;
702 } 703 }
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index a906e500a02b..4cd839b1407f 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -98,7 +98,7 @@ static void mct_u232_close (struct usb_serial_port *port,
98 struct file *filp); 98 struct file *filp);
99static void mct_u232_read_int_callback (struct urb *urb); 99static void mct_u232_read_int_callback (struct urb *urb);
100static void mct_u232_set_termios (struct usb_serial_port *port, 100static void mct_u232_set_termios (struct usb_serial_port *port,
101 struct termios * old); 101 struct ktermios * old);
102static int mct_u232_ioctl (struct usb_serial_port *port, 102static int mct_u232_ioctl (struct usb_serial_port *port,
103 struct file * file, 103 struct file * file,
104 unsigned int cmd, 104 unsigned int cmd,
@@ -137,6 +137,7 @@ static struct usb_serial_driver mct_u232_device = {
137 .name = "mct_u232", 137 .name = "mct_u232",
138 }, 138 },
139 .description = "MCT U232", 139 .description = "MCT U232",
140 .usb_driver = &mct_u232_driver,
140 .id_table = id_table_combined, 141 .id_table = id_table_combined,
141 .num_interrupt_in = 2, 142 .num_interrupt_in = 2,
142 .num_bulk_in = 0, 143 .num_bulk_in = 0,
@@ -556,7 +557,7 @@ exit:
556} /* mct_u232_read_int_callback */ 557} /* mct_u232_read_int_callback */
557 558
558static void mct_u232_set_termios (struct usb_serial_port *port, 559static void mct_u232_set_termios (struct usb_serial_port *port,
559 struct termios *old_termios) 560 struct ktermios *old_termios)
560{ 561{
561 struct usb_serial *serial = port->serial; 562 struct usb_serial *serial = port->serial;
562 struct mct_u232_private *priv = usb_get_serial_port_data(port); 563 struct mct_u232_private *priv = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 70f93b18292f..6109c6704a73 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1014,7 +1014,7 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port,
1014 * the specified new settings. 1014 * the specified new settings.
1015 */ 1015 */
1016static void change_port_settings(struct moschip_port *mos7720_port, 1016static void change_port_settings(struct moschip_port *mos7720_port,
1017 struct termios *old_termios) 1017 struct ktermios *old_termios)
1018{ 1018{
1019 struct usb_serial_port *port; 1019 struct usb_serial_port *port;
1020 struct usb_serial *serial; 1020 struct usb_serial *serial;
@@ -1203,7 +1203,7 @@ static void change_port_settings(struct moschip_port *mos7720_port,
1203 * termios structure. 1203 * termios structure.
1204 */ 1204 */
1205static void mos7720_set_termios(struct usb_serial_port *port, 1205static void mos7720_set_termios(struct usb_serial_port *port,
1206 struct termios *old_termios) 1206 struct ktermios *old_termios)
1207{ 1207{
1208 int status; 1208 int status;
1209 unsigned int cflag; 1209 unsigned int cflag;
@@ -1605,12 +1605,21 @@ static void mos7720_shutdown(struct usb_serial *serial)
1605 usb_set_serial_data(serial, NULL); 1605 usb_set_serial_data(serial, NULL);
1606} 1606}
1607 1607
1608static struct usb_driver usb_driver = {
1609 .name = "moschip7720",
1610 .probe = usb_serial_probe,
1611 .disconnect = usb_serial_disconnect,
1612 .id_table = moschip_port_id_table,
1613 .no_dynamic_id = 1,
1614};
1615
1608static struct usb_serial_driver moschip7720_2port_driver = { 1616static struct usb_serial_driver moschip7720_2port_driver = {
1609 .driver = { 1617 .driver = {
1610 .owner = THIS_MODULE, 1618 .owner = THIS_MODULE,
1611 .name = "moschip7720", 1619 .name = "moschip7720",
1612 }, 1620 },
1613 .description = "Moschip 2 port adapter", 1621 .description = "Moschip 2 port adapter",
1622 .usb_driver = &usb_driver,
1614 .id_table = moschip_port_id_table, 1623 .id_table = moschip_port_id_table,
1615 .num_interrupt_in = 1, 1624 .num_interrupt_in = 1,
1616 .num_bulk_in = 2, 1625 .num_bulk_in = 2,
@@ -1631,13 +1640,6 @@ static struct usb_serial_driver moschip7720_2port_driver = {
1631 .read_bulk_callback = mos7720_bulk_in_callback, 1640 .read_bulk_callback = mos7720_bulk_in_callback,
1632}; 1641};
1633 1642
1634static struct usb_driver usb_driver = {
1635 .name = "moschip7720",
1636 .probe = usb_serial_probe,
1637 .disconnect = usb_serial_disconnect,
1638 .id_table = moschip_port_id_table,
1639};
1640
1641static int __init moschip7720_init(void) 1643static int __init moschip7720_init(void)
1642{ 1644{
1643 int retval; 1645 int retval;
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 5432c6340086..b2264a87617b 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1931,7 +1931,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port,
1931 *****************************************************************************/ 1931 *****************************************************************************/
1932 1932
1933static void mos7840_change_port_settings(struct moschip_port *mos7840_port, 1933static void mos7840_change_port_settings(struct moschip_port *mos7840_port,
1934 struct termios *old_termios) 1934 struct ktermios *old_termios)
1935{ 1935{
1936 struct tty_struct *tty; 1936 struct tty_struct *tty;
1937 int baud; 1937 int baud;
@@ -2118,7 +2118,7 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port,
2118 *****************************************************************************/ 2118 *****************************************************************************/
2119 2119
2120static void mos7840_set_termios(struct usb_serial_port *port, 2120static void mos7840_set_termios(struct usb_serial_port *port,
2121 struct termios *old_termios) 2121 struct ktermios *old_termios)
2122{ 2122{
2123 int status; 2123 int status;
2124 unsigned int cflag; 2124 unsigned int cflag;
@@ -2460,12 +2460,6 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file,
2460 tty_ldisc_deref(ld); 2460 tty_ldisc_deref(ld);
2461 return 0; 2461 return 0;
2462 2462
2463 case TCGETS:
2464 if (kernel_termios_to_user_termios
2465 ((struct termios __user *)argp, tty->termios))
2466 return -EFAULT;
2467 return 0;
2468
2469 case TIOCSERGETLSR: 2463 case TIOCSERGETLSR:
2470 dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); 2464 dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number);
2471 return mos7840_get_lsr_info(mos7840_port, argp); 2465 return mos7840_get_lsr_info(mos7840_port, argp);
@@ -2840,12 +2834,21 @@ static void mos7840_shutdown(struct usb_serial *serial)
2840 2834
2841} 2835}
2842 2836
2837static struct usb_driver io_driver = {
2838 .name = "mos7840",
2839 .probe = usb_serial_probe,
2840 .disconnect = usb_serial_disconnect,
2841 .id_table = moschip_id_table_combined,
2842 .no_dynamic_id = 1,
2843};
2844
2843static struct usb_serial_driver moschip7840_4port_device = { 2845static struct usb_serial_driver moschip7840_4port_device = {
2844 .driver = { 2846 .driver = {
2845 .owner = THIS_MODULE, 2847 .owner = THIS_MODULE,
2846 .name = "mos7840", 2848 .name = "mos7840",
2847 }, 2849 },
2848 .description = DRIVER_DESC, 2850 .description = DRIVER_DESC,
2851 .usb_driver = &io_driver,
2849 .id_table = moschip_port_id_table, 2852 .id_table = moschip_port_id_table,
2850 .num_interrupt_in = 1, //NUM_DONT_CARE,//1, 2853 .num_interrupt_in = 1, //NUM_DONT_CARE,//1,
2851#ifdef check 2854#ifdef check
@@ -2875,13 +2878,6 @@ static struct usb_serial_driver moschip7840_4port_device = {
2875 .read_int_callback = mos7840_interrupt_callback, 2878 .read_int_callback = mos7840_interrupt_callback,
2876}; 2879};
2877 2880
2878static struct usb_driver io_driver = {
2879 .name = "mos7840",
2880 .probe = usb_serial_probe,
2881 .disconnect = usb_serial_disconnect,
2882 .id_table = moschip_id_table_combined,
2883};
2884
2885/**************************************************************************** 2881/****************************************************************************
2886 * moschip7840_init 2882 * moschip7840_init
2887 * This is called by the module subsystem, or on startup to initialize us 2883 * This is called by the module subsystem, or on startup to initialize us
diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c
index 054abee81652..90701111d746 100644
--- a/drivers/usb/serial/navman.c
+++ b/drivers/usb/serial/navman.c
@@ -119,6 +119,7 @@ static struct usb_serial_driver navman_device = {
119 .name = "navman", 119 .name = "navman",
120 }, 120 },
121 .id_table = id_table, 121 .id_table = id_table,
122 .usb_driver = &navman_driver,
122 .num_interrupt_in = NUM_DONT_CARE, 123 .num_interrupt_in = NUM_DONT_CARE,
123 .num_bulk_in = NUM_DONT_CARE, 124 .num_bulk_in = NUM_DONT_CARE,
124 .num_bulk_out = NUM_DONT_CARE, 125 .num_bulk_out = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index bc91d3b726fc..0216ac12a27d 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -93,6 +93,7 @@ static struct usb_serial_driver zyxel_omninet_device = {
93 .name = "omninet", 93 .name = "omninet",
94 }, 94 },
95 .description = "ZyXEL - omni.net lcd plus usb", 95 .description = "ZyXEL - omni.net lcd plus usb",
96 .usb_driver = &omninet_driver,
96 .id_table = id_table, 97 .id_table = id_table,
97 .num_interrupt_in = 1, 98 .num_interrupt_in = 1,
98 .num_bulk_in = 1, 99 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 130afbbd3fca..ced9f32b29d9 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -59,7 +59,7 @@ static int option_chars_in_buffer(struct usb_serial_port *port);
59static int option_ioctl(struct usb_serial_port *port, struct file *file, 59static int option_ioctl(struct usb_serial_port *port, struct file *file,
60 unsigned int cmd, unsigned long arg); 60 unsigned int cmd, unsigned long arg);
61static void option_set_termios(struct usb_serial_port *port, 61static void option_set_termios(struct usb_serial_port *port,
62 struct termios *old); 62 struct ktermios *old);
63static void option_break_ctl(struct usb_serial_port *port, int break_state); 63static void option_break_ctl(struct usb_serial_port *port, int break_state);
64static int option_tiocmget(struct usb_serial_port *port, struct file *file); 64static int option_tiocmget(struct usb_serial_port *port, struct file *file);
65static int option_tiocmset(struct usb_serial_port *port, struct file *file, 65static int option_tiocmset(struct usb_serial_port *port, struct file *file,
@@ -78,7 +78,9 @@ static int option_send_setup(struct usb_serial_port *port);
78#define OPTION_PRODUCT_FUSION2 0x6300 78#define OPTION_PRODUCT_FUSION2 0x6300
79#define OPTION_PRODUCT_COBRA 0x6500 79#define OPTION_PRODUCT_COBRA 0x6500
80#define OPTION_PRODUCT_COBRA2 0x6600 80#define OPTION_PRODUCT_COBRA2 0x6600
81#define OPTION_PRODUCT_GTMAX36 0x6701
81#define HUAWEI_PRODUCT_E600 0x1001 82#define HUAWEI_PRODUCT_E600 0x1001
83#define HUAWEI_PRODUCT_E220 0x1003
82#define AUDIOVOX_PRODUCT_AIRCARD 0x0112 84#define AUDIOVOX_PRODUCT_AIRCARD 0x0112
83#define NOVATELWIRELESS_PRODUCT_U740 0x1400 85#define NOVATELWIRELESS_PRODUCT_U740 0x1400
84#define ANYDATA_PRODUCT_ID 0x6501 86#define ANYDATA_PRODUCT_ID 0x6501
@@ -89,7 +91,9 @@ static struct usb_device_id option_ids[] = {
89 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, 91 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) },
90 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, 92 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) },
91 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, 93 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) },
94 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GTMAX36) },
92 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 95 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
96 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) },
93 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, 97 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) },
94 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, 98 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) },
95 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) }, 99 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) },
@@ -102,7 +106,9 @@ static struct usb_device_id option_ids1[] = {
102 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, 106 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) },
103 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, 107 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) },
104 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, 108 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) },
109 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GTMAX36) },
105 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 110 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
111 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) },
106 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, 112 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) },
107 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, 113 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) },
108 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) }, 114 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) },
@@ -129,6 +135,7 @@ static struct usb_serial_driver option_1port_device = {
129 .name = "option1", 135 .name = "option1",
130 }, 136 },
131 .description = "GSM modem (1-port)", 137 .description = "GSM modem (1-port)",
138 .usb_driver = &option_driver,
132 .id_table = option_ids1, 139 .id_table = option_ids1,
133 .num_interrupt_in = NUM_DONT_CARE, 140 .num_interrupt_in = NUM_DONT_CARE,
134 .num_bulk_in = NUM_DONT_CARE, 141 .num_bulk_in = NUM_DONT_CARE,
@@ -230,7 +237,7 @@ static void option_break_ctl(struct usb_serial_port *port, int break_state)
230} 237}
231 238
232static void option_set_termios(struct usb_serial_port *port, 239static void option_set_termios(struct usb_serial_port *port,
233 struct termios *old_termios) 240 struct ktermios *old_termios)
234{ 241{
235 dbg("%s", __FUNCTION__); 242 dbg("%s", __FUNCTION__);
236 243
@@ -622,6 +629,9 @@ static int option_send_setup(struct usb_serial_port *port)
622 629
623 dbg("%s", __FUNCTION__); 630 dbg("%s", __FUNCTION__);
624 631
632 if (port->number != 0)
633 return 0;
634
625 portdata = usb_get_serial_port_data(port); 635 portdata = usb_get_serial_port_data(port);
626 636
627 if (port->tty) { 637 if (port->tty) {
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index bc800c8787a8..6c083d4e2c9b 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -159,7 +159,7 @@ static struct pl2303_buf *pl2303_buf_alloc(unsigned int size)
159 if (size == 0) 159 if (size == 0)
160 return NULL; 160 return NULL;
161 161
162 pb = (struct pl2303_buf *)kmalloc(sizeof(struct pl2303_buf), GFP_KERNEL); 162 pb = kmalloc(sizeof(struct pl2303_buf), GFP_KERNEL);
163 if (pb == NULL) 163 if (pb == NULL)
164 return NULL; 164 return NULL;
165 165
@@ -455,7 +455,7 @@ static int pl2303_chars_in_buffer(struct usb_serial_port *port)
455} 455}
456 456
457static void pl2303_set_termios(struct usb_serial_port *port, 457static void pl2303_set_termios(struct usb_serial_port *port,
458 struct termios *old_termios) 458 struct ktermios *old_termios)
459{ 459{
460 struct usb_serial *serial = port->serial; 460 struct usb_serial *serial = port->serial;
461 struct pl2303_private *priv = usb_get_serial_port_data(port); 461 struct pl2303_private *priv = usb_get_serial_port_data(port);
@@ -687,7 +687,7 @@ static void pl2303_close(struct usb_serial_port *port, struct file *filp)
687 687
688static int pl2303_open(struct usb_serial_port *port, struct file *filp) 688static int pl2303_open(struct usb_serial_port *port, struct file *filp)
689{ 689{
690 struct termios tmp_termios; 690 struct ktermios tmp_termios;
691 struct usb_serial *serial = port->serial; 691 struct usb_serial *serial = port->serial;
692 struct pl2303_private *priv = usb_get_serial_port_data(port); 692 struct pl2303_private *priv = usb_get_serial_port_data(port);
693 unsigned char *buf; 693 unsigned char *buf;
@@ -1118,6 +1118,7 @@ static struct usb_serial_driver pl2303_device = {
1118 .name = "pl2303", 1118 .name = "pl2303",
1119 }, 1119 },
1120 .id_table = id_table, 1120 .id_table = id_table,
1121 .usb_driver = &pl2303_driver,
1121 .num_interrupt_in = NUM_DONT_CARE, 1122 .num_interrupt_in = NUM_DONT_CARE,
1122 .num_bulk_in = 1, 1123 .num_bulk_in = 1,
1123 .num_bulk_out = 1, 1124 .num_bulk_out = 1,
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index 30b7ebc8d45d..5a03a3fc9386 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -402,6 +402,7 @@ static struct usb_serial_driver safe_device = {
402 .name = "safe_serial", 402 .name = "safe_serial",
403 }, 403 },
404 .id_table = id_table, 404 .id_table = id_table,
405 .usb_driver = &safe_driver,
405 .num_interrupt_in = NUM_DONT_CARE, 406 .num_interrupt_in = NUM_DONT_CARE,
406 .num_bulk_in = NUM_DONT_CARE, 407 .num_bulk_in = NUM_DONT_CARE,
407 .num_bulk_out = NUM_DONT_CARE, 408 .num_bulk_out = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 4b5097fa48d7..ecedd833818d 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -13,10 +13,9 @@
13 Portions based on the option driver by Matthias Urlichs <smurf@smurf.noris.de> 13 Portions based on the option driver by Matthias Urlichs <smurf@smurf.noris.de>
14 Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> 14 Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org>
15 15
16 History:
17*/ 16*/
18 17
19#define DRIVER_VERSION "v.1.0.5" 18#define DRIVER_VERSION "v.1.0.6"
20#define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>" 19#define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>"
21#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" 20#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems"
22 21
@@ -31,14 +30,15 @@
31 30
32 31
33static struct usb_device_id id_table [] = { 32static struct usb_device_id id_table [] = {
33 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
34 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ 34 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
35 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
35 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 36 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
36 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
37 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ 37 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
38 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 38 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
39 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ 39 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
40 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
40 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ 41 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
41 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 for Europe */
42 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */ 42 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */
43 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ 43 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
44 44
@@ -55,14 +55,15 @@ static struct usb_device_id id_table_1port [] = {
55}; 55};
56 56
57static struct usb_device_id id_table_3port [] = { 57static struct usb_device_id id_table_3port [] = {
58 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
58 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ 59 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
60 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
59 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 61 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
60 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
61 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ 62 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
62 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 63 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
63 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ 64 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
65 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
64 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ 66 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
65 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 for Europe */
66 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */ 67 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */
67 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ 68 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
68 { } 69 { }
@@ -81,7 +82,7 @@ static int debug;
81 82
82/* per port private data */ 83/* per port private data */
83#define N_IN_URB 4 84#define N_IN_URB 4
84#define N_OUT_URB 1 85#define N_OUT_URB 4
85#define IN_BUFLEN 4096 86#define IN_BUFLEN 4096
86#define OUT_BUFLEN 128 87#define OUT_BUFLEN 128
87 88
@@ -145,7 +146,7 @@ static void sierra_break_ctl(struct usb_serial_port *port, int break_state)
145} 146}
146 147
147static void sierra_set_termios(struct usb_serial_port *port, 148static void sierra_set_termios(struct usb_serial_port *port,
148 struct termios *old_termios) 149 struct ktermios *old_termios)
149{ 150{
150 dbg("%s", __FUNCTION__); 151 dbg("%s", __FUNCTION__);
151 152
@@ -396,6 +397,8 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp)
396 struct usb_serial *serial = port->serial; 397 struct usb_serial *serial = port->serial;
397 int i, err; 398 int i, err;
398 struct urb *urb; 399 struct urb *urb;
400 int result;
401 __u16 set_mode_dzero = 0x0000;
399 402
400 portdata = usb_get_serial_port_data(port); 403 portdata = usb_get_serial_port_data(port);
401 404
@@ -442,6 +445,12 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp)
442 445
443 port->tty->low_latency = 1; 446 port->tty->low_latency = 1;
444 447
448 /* set mode to D0 */
449 result = usb_control_msg(serial->dev,
450 usb_rcvctrlpipe(serial->dev, 0),
451 0x00, 0x40, set_mode_dzero, 0, NULL,
452 0, USB_CTRL_SET_TIMEOUT);
453
445 sierra_send_setup(port); 454 sierra_send_setup(port);
446 455
447 return (0); 456 return (0);
@@ -614,6 +623,7 @@ static struct usb_serial_driver sierra_1port_device = {
614 }, 623 },
615 .description = "Sierra USB modem (1 port)", 624 .description = "Sierra USB modem (1 port)",
616 .id_table = id_table_1port, 625 .id_table = id_table_1port,
626 .usb_driver = &sierra_driver,
617 .num_interrupt_in = NUM_DONT_CARE, 627 .num_interrupt_in = NUM_DONT_CARE,
618 .num_bulk_in = 1, 628 .num_bulk_in = 1,
619 .num_bulk_out = 1, 629 .num_bulk_out = 1,
@@ -642,6 +652,7 @@ static struct usb_serial_driver sierra_3port_device = {
642 }, 652 },
643 .description = "Sierra USB modem (3 port)", 653 .description = "Sierra USB modem (3 port)",
644 .id_table = id_table_3port, 654 .id_table = id_table_3port,
655 .usb_driver = &sierra_driver,
645 .num_interrupt_in = NUM_DONT_CARE, 656 .num_interrupt_in = NUM_DONT_CARE,
646 .num_bulk_in = 3, 657 .num_bulk_in = 3,
647 .num_bulk_out = 3, 658 .num_bulk_out = 3,
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index ae98d8cbdbb8..4203e2b1a761 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -161,7 +161,7 @@ static void ti_throttle(struct usb_serial_port *port);
161static void ti_unthrottle(struct usb_serial_port *port); 161static void ti_unthrottle(struct usb_serial_port *port);
162static int ti_ioctl(struct usb_serial_port *port, struct file *file, unsigned int cmd, unsigned long arg); 162static int ti_ioctl(struct usb_serial_port *port, struct file *file, unsigned int cmd, unsigned long arg);
163static void ti_set_termios(struct usb_serial_port *port, 163static void ti_set_termios(struct usb_serial_port *port,
164 struct termios *old_termios); 164 struct ktermios *old_termios);
165static int ti_tiocmget(struct usb_serial_port *port, struct file *file); 165static int ti_tiocmget(struct usb_serial_port *port, struct file *file);
166static int ti_tiocmset(struct usb_serial_port *port, struct file *file, 166static int ti_tiocmset(struct usb_serial_port *port, struct file *file,
167 unsigned int set, unsigned int clear); 167 unsigned int set, unsigned int clear);
@@ -262,6 +262,7 @@ static struct usb_serial_driver ti_1port_device = {
262 .name = "ti_usb_3410_5052_1", 262 .name = "ti_usb_3410_5052_1",
263 }, 263 },
264 .description = "TI USB 3410 1 port adapter", 264 .description = "TI USB 3410 1 port adapter",
265 .usb_driver = &ti_usb_driver,
265 .id_table = ti_id_table_3410, 266 .id_table = ti_id_table_3410,
266 .num_interrupt_in = 1, 267 .num_interrupt_in = 1,
267 .num_bulk_in = 1, 268 .num_bulk_in = 1,
@@ -292,6 +293,7 @@ static struct usb_serial_driver ti_2port_device = {
292 .name = "ti_usb_3410_5052_2", 293 .name = "ti_usb_3410_5052_2",
293 }, 294 },
294 .description = "TI USB 5052 2 port adapter", 295 .description = "TI USB 5052 2 port adapter",
296 .usb_driver = &ti_usb_driver,
295 .id_table = ti_id_table_5052, 297 .id_table = ti_id_table_5052,
296 .num_interrupt_in = 1, 298 .num_interrupt_in = 1,
297 .num_bulk_in = 2, 299 .num_bulk_in = 2,
@@ -881,7 +883,7 @@ static int ti_ioctl(struct usb_serial_port *port, struct file *file,
881 883
882 884
883static void ti_set_termios(struct usb_serial_port *port, 885static void ti_set_termios(struct usb_serial_port *port,
884 struct termios *old_termios) 886 struct ktermios *old_termios)
885{ 887{
886 struct ti_port *tport = usb_get_serial_port_data(port); 888 struct ti_port *tport = usb_get_serial_port_data(port);
887 struct tty_struct *tty = port->tty; 889 struct tty_struct *tty = port->tty;
@@ -1710,7 +1712,7 @@ static struct circ_buf *ti_buf_alloc(void)
1710{ 1712{
1711 struct circ_buf *cb; 1713 struct circ_buf *cb;
1712 1714
1713 cb = (struct circ_buf *)kmalloc(sizeof(struct circ_buf), GFP_KERNEL); 1715 cb = kmalloc(sizeof(struct circ_buf), GFP_KERNEL);
1714 if (cb == NULL) 1716 if (cb == NULL)
1715 return NULL; 1717 return NULL;
1716 1718
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 3d5072f14b8d..6bf22a28adb8 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -59,14 +59,19 @@ static struct usb_driver usb_serial_driver = {
59 59
60static int debug; 60static int debug;
61static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */ 61static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */
62static spinlock_t table_lock;
62static LIST_HEAD(usb_serial_driver_list); 63static LIST_HEAD(usb_serial_driver_list);
63 64
64struct usb_serial *usb_serial_get_by_index(unsigned index) 65struct usb_serial *usb_serial_get_by_index(unsigned index)
65{ 66{
66 struct usb_serial *serial = serial_table[index]; 67 struct usb_serial *serial;
68
69 spin_lock(&table_lock);
70 serial = serial_table[index];
67 71
68 if (serial) 72 if (serial)
69 kref_get(&serial->kref); 73 kref_get(&serial->kref);
74 spin_unlock(&table_lock);
70 return serial; 75 return serial;
71} 76}
72 77
@@ -78,6 +83,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
78 dbg("%s %d", __FUNCTION__, num_ports); 83 dbg("%s %d", __FUNCTION__, num_ports);
79 84
80 *minor = 0; 85 *minor = 0;
86 spin_lock(&table_lock);
81 for (i = 0; i < SERIAL_TTY_MINORS; ++i) { 87 for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
82 if (serial_table[i]) 88 if (serial_table[i])
83 continue; 89 continue;
@@ -96,8 +102,10 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
96 dbg("%s - minor base = %d", __FUNCTION__, *minor); 102 dbg("%s - minor base = %d", __FUNCTION__, *minor);
97 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) 103 for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i)
98 serial_table[i] = serial; 104 serial_table[i] = serial;
105 spin_unlock(&table_lock);
99 return serial; 106 return serial;
100 } 107 }
108 spin_unlock(&table_lock);
101 return NULL; 109 return NULL;
102} 110}
103 111
@@ -110,9 +118,11 @@ static void return_serial(struct usb_serial *serial)
110 if (serial == NULL) 118 if (serial == NULL)
111 return; 119 return;
112 120
121 spin_lock(&table_lock);
113 for (i = 0; i < serial->num_ports; ++i) { 122 for (i = 0; i < serial->num_ports; ++i) {
114 serial_table[serial->minor + i] = NULL; 123 serial_table[serial->minor + i] = NULL;
115 } 124 }
125 spin_unlock(&table_lock);
116} 126}
117 127
118static void destroy_serial(struct kref *kref) 128static void destroy_serial(struct kref *kref)
@@ -271,7 +281,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
271static int serial_write (struct tty_struct * tty, const unsigned char *buf, int count) 281static int serial_write (struct tty_struct * tty, const unsigned char *buf, int count)
272{ 282{
273 struct usb_serial_port *port = tty->driver_data; 283 struct usb_serial_port *port = tty->driver_data;
274 int retval = -EINVAL; 284 int retval = -ENODEV;
275 285
276 if (!port || port->serial->dev->state == USB_STATE_NOTATTACHED) 286 if (!port || port->serial->dev->state == USB_STATE_NOTATTACHED)
277 goto exit; 287 goto exit;
@@ -279,6 +289,7 @@ static int serial_write (struct tty_struct * tty, const unsigned char *buf, int
279 dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); 289 dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count);
280 290
281 if (!port->open_count) { 291 if (!port->open_count) {
292 retval = -EINVAL;
282 dbg("%s - port not opened", __FUNCTION__); 293 dbg("%s - port not opened", __FUNCTION__);
283 goto exit; 294 goto exit;
284 } 295 }
@@ -397,7 +408,7 @@ exit:
397 return retval; 408 return retval;
398} 409}
399 410
400static void serial_set_termios (struct tty_struct *tty, struct termios * old) 411static void serial_set_termios (struct tty_struct *tty, struct ktermios * old)
401{ 412{
402 struct usb_serial_port *port = tty->driver_data; 413 struct usb_serial_port *port = tty->driver_data;
403 414
@@ -559,15 +570,20 @@ static void port_release(struct device *dev)
559 port_free(port); 570 port_free(port);
560} 571}
561 572
562static void port_free(struct usb_serial_port *port) 573static void kill_traffic(struct usb_serial_port *port)
563{ 574{
564 usb_kill_urb(port->read_urb); 575 usb_kill_urb(port->read_urb);
565 usb_free_urb(port->read_urb);
566 usb_kill_urb(port->write_urb); 576 usb_kill_urb(port->write_urb);
567 usb_free_urb(port->write_urb);
568 usb_kill_urb(port->interrupt_in_urb); 577 usb_kill_urb(port->interrupt_in_urb);
569 usb_free_urb(port->interrupt_in_urb);
570 usb_kill_urb(port->interrupt_out_urb); 578 usb_kill_urb(port->interrupt_out_urb);
579}
580
581static void port_free(struct usb_serial_port *port)
582{
583 kill_traffic(port);
584 usb_free_urb(port->read_urb);
585 usb_free_urb(port->write_urb);
586 usb_free_urb(port->interrupt_in_urb);
571 usb_free_urb(port->interrupt_out_urb); 587 usb_free_urb(port->interrupt_out_urb);
572 kfree(port->bulk_in_buffer); 588 kfree(port->bulk_in_buffer);
573 kfree(port->bulk_out_buffer); 589 kfree(port->bulk_out_buffer);
@@ -596,6 +612,39 @@ static struct usb_serial * create_serial (struct usb_device *dev,
596 return serial; 612 return serial;
597} 613}
598 614
615static const struct usb_device_id *match_dynamic_id(struct usb_interface *intf,
616 struct usb_serial_driver *drv)
617{
618 struct usb_dynid *dynid;
619
620 spin_lock(&drv->dynids.lock);
621 list_for_each_entry(dynid, &drv->dynids.list, node) {
622 if (usb_match_one_id(intf, &dynid->id)) {
623 spin_unlock(&drv->dynids.lock);
624 return &dynid->id;
625 }
626 }
627 spin_unlock(&drv->dynids.lock);
628 return NULL;
629}
630
631static const struct usb_device_id *get_iface_id(struct usb_serial_driver *drv,
632 struct usb_interface *intf)
633{
634 const struct usb_device_id *id;
635
636 id = usb_match_id(intf, drv->id_table);
637 if (id) {
638 dbg("static descriptor matches");
639 goto exit;
640 }
641 id = match_dynamic_id(intf, drv);
642 if (id)
643 dbg("dynamic descriptor matches");
644exit:
645 return id;
646}
647
599static struct usb_serial_driver *search_serial_device(struct usb_interface *iface) 648static struct usb_serial_driver *search_serial_device(struct usb_interface *iface)
600{ 649{
601 struct list_head *p; 650 struct list_head *p;
@@ -605,11 +654,9 @@ static struct usb_serial_driver *search_serial_device(struct usb_interface *ifac
605 /* Check if the usb id matches a known device */ 654 /* Check if the usb id matches a known device */
606 list_for_each(p, &usb_serial_driver_list) { 655 list_for_each(p, &usb_serial_driver_list) {
607 t = list_entry(p, struct usb_serial_driver, driver_list); 656 t = list_entry(p, struct usb_serial_driver, driver_list);
608 id = usb_match_id(iface, t->id_table); 657 id = get_iface_id(t, iface);
609 if (id != NULL) { 658 if (id)
610 dbg("descriptor matches");
611 return t; 659 return t;
612 }
613 } 660 }
614 661
615 return NULL; 662 return NULL;
@@ -639,14 +686,17 @@ int usb_serial_probe(struct usb_interface *interface,
639 int num_ports = 0; 686 int num_ports = 0;
640 int max_endpoints; 687 int max_endpoints;
641 688
689 lock_kernel(); /* guard against unloading a serial driver module */
642 type = search_serial_device(interface); 690 type = search_serial_device(interface);
643 if (!type) { 691 if (!type) {
692 unlock_kernel();
644 dbg("none matched"); 693 dbg("none matched");
645 return -ENODEV; 694 return -ENODEV;
646 } 695 }
647 696
648 serial = create_serial (dev, interface, type); 697 serial = create_serial (dev, interface, type);
649 if (!serial) { 698 if (!serial) {
699 unlock_kernel();
650 dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__); 700 dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__);
651 return -ENOMEM; 701 return -ENOMEM;
652 } 702 }
@@ -656,16 +706,18 @@ int usb_serial_probe(struct usb_interface *interface,
656 const struct usb_device_id *id; 706 const struct usb_device_id *id;
657 707
658 if (!try_module_get(type->driver.owner)) { 708 if (!try_module_get(type->driver.owner)) {
709 unlock_kernel();
659 dev_err(&interface->dev, "module get failed, exiting\n"); 710 dev_err(&interface->dev, "module get failed, exiting\n");
660 kfree (serial); 711 kfree (serial);
661 return -EIO; 712 return -EIO;
662 } 713 }
663 714
664 id = usb_match_id(interface, type->id_table); 715 id = get_iface_id(type, interface);
665 retval = type->probe(serial, id); 716 retval = type->probe(serial, id);
666 module_put(type->driver.owner); 717 module_put(type->driver.owner);
667 718
668 if (retval) { 719 if (retval) {
720 unlock_kernel();
669 dbg ("sub driver rejected device"); 721 dbg ("sub driver rejected device");
670 kfree (serial); 722 kfree (serial);
671 return retval; 723 return retval;
@@ -735,6 +787,7 @@ int usb_serial_probe(struct usb_interface *interface,
735 * properly during a later invocation of usb_serial_probe 787 * properly during a later invocation of usb_serial_probe
736 */ 788 */
737 if (num_bulk_in == 0 || num_bulk_out == 0) { 789 if (num_bulk_in == 0 || num_bulk_out == 0) {
790 unlock_kernel();
738 dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n"); 791 dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n");
739 kfree (serial); 792 kfree (serial);
740 return -ENODEV; 793 return -ENODEV;
@@ -750,6 +803,7 @@ int usb_serial_probe(struct usb_interface *interface,
750 if (type == &usb_serial_generic_device) { 803 if (type == &usb_serial_generic_device) {
751 num_ports = num_bulk_out; 804 num_ports = num_bulk_out;
752 if (num_ports == 0) { 805 if (num_ports == 0) {
806 unlock_kernel();
753 dev_err(&interface->dev, "Generic device with no bulk out, not allowed.\n"); 807 dev_err(&interface->dev, "Generic device with no bulk out, not allowed.\n");
754 kfree (serial); 808 kfree (serial);
755 return -EIO; 809 return -EIO;
@@ -760,6 +814,7 @@ int usb_serial_probe(struct usb_interface *interface,
760 /* if this device type has a calc_num_ports function, call it */ 814 /* if this device type has a calc_num_ports function, call it */
761 if (type->calc_num_ports) { 815 if (type->calc_num_ports) {
762 if (!try_module_get(type->driver.owner)) { 816 if (!try_module_get(type->driver.owner)) {
817 unlock_kernel();
763 dev_err(&interface->dev, "module get failed, exiting\n"); 818 dev_err(&interface->dev, "module get failed, exiting\n");
764 kfree (serial); 819 kfree (serial);
765 return -EIO; 820 return -EIO;
@@ -771,12 +826,6 @@ int usb_serial_probe(struct usb_interface *interface,
771 num_ports = type->num_ports; 826 num_ports = type->num_ports;
772 } 827 }
773 828
774 if (get_free_serial (serial, num_ports, &minor) == NULL) {
775 dev_err(&interface->dev, "No more free serial devices\n");
776 kfree (serial);
777 return -ENOMEM;
778 }
779
780 serial->minor = minor; 829 serial->minor = minor;
781 serial->num_ports = num_ports; 830 serial->num_ports = num_ports;
782 serial->num_bulk_in = num_bulk_in; 831 serial->num_bulk_in = num_bulk_in;
@@ -791,6 +840,8 @@ int usb_serial_probe(struct usb_interface *interface,
791 max_endpoints = max(max_endpoints, num_interrupt_out); 840 max_endpoints = max(max_endpoints, num_interrupt_out);
792 max_endpoints = max(max_endpoints, (int)serial->num_ports); 841 max_endpoints = max(max_endpoints, (int)serial->num_ports);
793 serial->num_port_pointers = max_endpoints; 842 serial->num_port_pointers = max_endpoints;
843 unlock_kernel();
844
794 dbg("%s - setting up %d port structures for this device", __FUNCTION__, max_endpoints); 845 dbg("%s - setting up %d port structures for this device", __FUNCTION__, max_endpoints);
795 for (i = 0; i < max_endpoints; ++i) { 846 for (i = 0; i < max_endpoints; ++i) {
796 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); 847 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL);
@@ -925,6 +976,11 @@ int usb_serial_probe(struct usb_interface *interface,
925 } 976 }
926 } 977 }
927 978
979 if (get_free_serial (serial, num_ports, &minor) == NULL) {
980 dev_err(&interface->dev, "No more free serial devices\n");
981 goto probe_error;
982 }
983
928 /* register all of the individual ports with the driver core */ 984 /* register all of the individual ports with the driver core */
929 for (i = 0; i < num_ports; ++i) { 985 for (i = 0; i < num_ports; ++i) {
930 port = serial->port[i]; 986 port = serial->port[i];
@@ -1002,8 +1058,11 @@ void usb_serial_disconnect(struct usb_interface *interface)
1002 if (serial) { 1058 if (serial) {
1003 for (i = 0; i < serial->num_ports; ++i) { 1059 for (i = 0; i < serial->num_ports; ++i) {
1004 port = serial->port[i]; 1060 port = serial->port[i];
1005 if (port && port->tty) 1061 if (port) {
1006 tty_hangup(port->tty); 1062 if (port->tty)
1063 tty_hangup(port->tty);
1064 kill_traffic(port);
1065 }
1007 } 1066 }
1008 /* let the last holder of this object 1067 /* let the last holder of this object
1009 * cause it to be cleaned up */ 1068 * cause it to be cleaned up */
@@ -1040,6 +1099,7 @@ static int __init usb_serial_init(void)
1040 return -ENOMEM; 1099 return -ENOMEM;
1041 1100
1042 /* Initialize our global data */ 1101 /* Initialize our global data */
1102 spin_lock_init(&table_lock);
1043 for (i = 0; i < SERIAL_TTY_MINORS; ++i) { 1103 for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
1044 serial_table[i] = NULL; 1104 serial_table[i] = NULL;
1045 } 1105 }
@@ -1138,7 +1198,7 @@ static void fixup_generic(struct usb_serial_driver *device)
1138 set_to_generic_if_null(device, shutdown); 1198 set_to_generic_if_null(device, shutdown);
1139} 1199}
1140 1200
1141int usb_serial_register(struct usb_serial_driver *driver) 1201int usb_serial_register(struct usb_serial_driver *driver) /* must be called with BKL held */
1142{ 1202{
1143 int retval; 1203 int retval;
1144 1204
@@ -1162,7 +1222,7 @@ int usb_serial_register(struct usb_serial_driver *driver)
1162} 1222}
1163 1223
1164 1224
1165void usb_serial_deregister(struct usb_serial_driver *device) 1225void usb_serial_deregister(struct usb_serial_driver *device) /* must be called with BKL held */
1166{ 1226{
1167 info("USB Serial deregistering driver %s", device->description); 1227 info("USB Serial deregistering driver %s", device->description);
1168 list_del(&device->driver_list); 1228 list_del(&device->driver_list);
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index eef5eaa5fa0b..2f59ff226e2c 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -46,7 +46,7 @@ static int visor_probe (struct usb_serial *serial, const struct usb_device_id
46static int visor_calc_num_ports(struct usb_serial *serial); 46static int visor_calc_num_ports(struct usb_serial *serial);
47static void visor_shutdown (struct usb_serial *serial); 47static void visor_shutdown (struct usb_serial *serial);
48static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); 48static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
49static void visor_set_termios (struct usb_serial_port *port, struct termios *old_termios); 49static void visor_set_termios (struct usb_serial_port *port, struct ktermios *old_termios);
50static void visor_write_bulk_callback (struct urb *urb); 50static void visor_write_bulk_callback (struct urb *urb);
51static void visor_read_bulk_callback (struct urb *urb); 51static void visor_read_bulk_callback (struct urb *urb);
52static void visor_read_int_callback (struct urb *urb); 52static void visor_read_int_callback (struct urb *urb);
@@ -90,8 +90,6 @@ static struct usb_device_id id_table [] = {
90 .driver_info = (kernel_ulong_t)&palm_os_4_probe }, 90 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
91 { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID), 91 { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID),
92 .driver_info = (kernel_ulong_t)&palm_os_4_probe }, 92 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
93 { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID),
94 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
95 { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID), 93 { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID),
96 .driver_info = (kernel_ulong_t)&palm_os_4_probe }, 94 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
97 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID), 95 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID),
@@ -151,7 +149,6 @@ static struct usb_device_id id_table_combined [] = {
151 { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID) }, 149 { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_T_ID) },
152 { USB_DEVICE(PALM_VENDOR_ID, PALM_TREO_650) }, 150 { USB_DEVICE(PALM_VENDOR_ID, PALM_TREO_650) },
153 { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID) }, 151 { USB_DEVICE(PALM_VENDOR_ID, PALM_TUNGSTEN_Z_ID) },
154 { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE31_ID) },
155 { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID) }, 152 { USB_DEVICE(PALM_VENDOR_ID, PALM_ZIRE_ID) },
156 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_3_5_ID) }, 153 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_3_5_ID) },
157 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID) }, 154 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_4_0_ID) },
@@ -189,6 +186,7 @@ static struct usb_serial_driver handspring_device = {
189 .name = "visor", 186 .name = "visor",
190 }, 187 },
191 .description = "Handspring Visor / Palm OS", 188 .description = "Handspring Visor / Palm OS",
189 .usb_driver = &visor_driver,
192 .id_table = id_table, 190 .id_table = id_table,
193 .num_interrupt_in = NUM_DONT_CARE, 191 .num_interrupt_in = NUM_DONT_CARE,
194 .num_bulk_in = 2, 192 .num_bulk_in = 2,
@@ -219,6 +217,7 @@ static struct usb_serial_driver clie_5_device = {
219 .name = "clie_5", 217 .name = "clie_5",
220 }, 218 },
221 .description = "Sony Clie 5.0", 219 .description = "Sony Clie 5.0",
220 .usb_driver = &visor_driver,
222 .id_table = clie_id_5_table, 221 .id_table = clie_id_5_table,
223 .num_interrupt_in = NUM_DONT_CARE, 222 .num_interrupt_in = NUM_DONT_CARE,
224 .num_bulk_in = 2, 223 .num_bulk_in = 2,
@@ -249,6 +248,7 @@ static struct usb_serial_driver clie_3_5_device = {
249 .name = "clie_3.5", 248 .name = "clie_3.5",
250 }, 249 },
251 .description = "Sony Clie 3.5", 250 .description = "Sony Clie 3.5",
251 .usb_driver = &visor_driver,
252 .id_table = clie_id_3_5_table, 252 .id_table = clie_id_3_5_table,
253 .num_interrupt_in = 0, 253 .num_interrupt_in = 0,
254 .num_bulk_in = 1, 254 .num_bulk_in = 1,
@@ -916,7 +916,7 @@ static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsign
916 916
917 917
918/* This function is all nice and good, but we don't change anything based on it :) */ 918/* This function is all nice and good, but we don't change anything based on it :) */
919static void visor_set_termios (struct usb_serial_port *port, struct termios *old_termios) 919static void visor_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
920{ 920{
921 unsigned int cflag; 921 unsigned int cflag;
922 922
diff --git a/drivers/usb/serial/visor.h b/drivers/usb/serial/visor.h
index 765118d83fb6..4ce6f62a6f39 100644
--- a/drivers/usb/serial/visor.h
+++ b/drivers/usb/serial/visor.h
@@ -32,7 +32,6 @@
32#define PALM_TUNGSTEN_T_ID 0x0060 32#define PALM_TUNGSTEN_T_ID 0x0060
33#define PALM_TREO_650 0x0061 33#define PALM_TREO_650 0x0061
34#define PALM_TUNGSTEN_Z_ID 0x0031 34#define PALM_TUNGSTEN_Z_ID 0x0031
35#define PALM_ZIRE31_ID 0x0061
36#define PALM_ZIRE_ID 0x0070 35#define PALM_ZIRE_ID 0x0070
37#define PALM_M100_ID 0x0080 36#define PALM_M100_ID 0x0080
38 37
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 154c7d290597..bf16e9e1d84e 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -145,7 +145,7 @@ static void whiteheat_close (struct usb_serial_port *port, struct file *filp);
145static int whiteheat_write (struct usb_serial_port *port, const unsigned char *buf, int count); 145static int whiteheat_write (struct usb_serial_port *port, const unsigned char *buf, int count);
146static int whiteheat_write_room (struct usb_serial_port *port); 146static int whiteheat_write_room (struct usb_serial_port *port);
147static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); 147static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
148static void whiteheat_set_termios (struct usb_serial_port *port, struct termios * old); 148static void whiteheat_set_termios (struct usb_serial_port *port, struct ktermios * old);
149static int whiteheat_tiocmget (struct usb_serial_port *port, struct file *file); 149static int whiteheat_tiocmget (struct usb_serial_port *port, struct file *file);
150static int whiteheat_tiocmset (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear); 150static int whiteheat_tiocmset (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear);
151static void whiteheat_break_ctl (struct usb_serial_port *port, int break_state); 151static void whiteheat_break_ctl (struct usb_serial_port *port, int break_state);
@@ -161,6 +161,7 @@ static struct usb_serial_driver whiteheat_fake_device = {
161 .name = "whiteheatnofirm", 161 .name = "whiteheatnofirm",
162 }, 162 },
163 .description = "Connect Tech - WhiteHEAT - (prerenumeration)", 163 .description = "Connect Tech - WhiteHEAT - (prerenumeration)",
164 .usb_driver = &whiteheat_driver,
164 .id_table = id_table_prerenumeration, 165 .id_table = id_table_prerenumeration,
165 .num_interrupt_in = NUM_DONT_CARE, 166 .num_interrupt_in = NUM_DONT_CARE,
166 .num_bulk_in = NUM_DONT_CARE, 167 .num_bulk_in = NUM_DONT_CARE,
@@ -176,6 +177,7 @@ static struct usb_serial_driver whiteheat_device = {
176 .name = "whiteheat", 177 .name = "whiteheat",
177 }, 178 },
178 .description = "Connect Tech - WhiteHEAT", 179 .description = "Connect Tech - WhiteHEAT",
180 .usb_driver = &whiteheat_driver,
179 .id_table = id_table_std, 181 .id_table = id_table_std,
180 .num_interrupt_in = NUM_DONT_CARE, 182 .num_interrupt_in = NUM_DONT_CARE,
181 .num_bulk_in = NUM_DONT_CARE, 183 .num_bulk_in = NUM_DONT_CARE,
@@ -416,7 +418,7 @@ static int whiteheat_attach (struct usb_serial *serial)
416 for (i = 0; i < serial->num_ports; i++) { 418 for (i = 0; i < serial->num_ports; i++) {
417 port = serial->port[i]; 419 port = serial->port[i];
418 420
419 info = (struct whiteheat_private *)kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); 421 info = kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL);
420 if (info == NULL) { 422 if (info == NULL) {
421 err("%s: Out of memory for port structures\n", serial->type->description); 423 err("%s: Out of memory for port structures\n", serial->type->description);
422 goto no_private; 424 goto no_private;
@@ -487,7 +489,7 @@ static int whiteheat_attach (struct usb_serial *serial)
487 usb_set_serial_port_data(port, info); 489 usb_set_serial_port_data(port, info);
488 } 490 }
489 491
490 command_info = (struct whiteheat_command_private *)kmalloc(sizeof(struct whiteheat_command_private), GFP_KERNEL); 492 command_info = kmalloc(sizeof(struct whiteheat_command_private), GFP_KERNEL);
491 if (command_info == NULL) { 493 if (command_info == NULL) {
492 err("%s: Out of memory for port structures\n", serial->type->description); 494 err("%s: Out of memory for port structures\n", serial->type->description);
493 goto no_command_private; 495 goto no_command_private;
@@ -597,7 +599,7 @@ static void whiteheat_shutdown (struct usb_serial *serial)
597static int whiteheat_open (struct usb_serial_port *port, struct file *filp) 599static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
598{ 600{
599 int retval = 0; 601 int retval = 0;
600 struct termios old_term; 602 struct ktermios old_term;
601 603
602 dbg("%s - port %d", __FUNCTION__, port->number); 604 dbg("%s - port %d", __FUNCTION__, port->number);
603 605
@@ -870,7 +872,7 @@ static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, un
870} 872}
871 873
872 874
873static void whiteheat_set_termios (struct usb_serial_port *port, struct termios *old_termios) 875static void whiteheat_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
874{ 876{
875 dbg("%s -port %d", __FUNCTION__, port->number); 877 dbg("%s -port %d", __FUNCTION__, port->number);
876 878