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.c1
-rw-r--r--drivers/usb/serial/ark3116.c2
-rw-r--r--drivers/usb/serial/belkin_sa.c1
-rw-r--r--drivers/usb/serial/bus.c45
-rw-r--r--drivers/usb/serial/cp2101.c9
-rw-r--r--drivers/usb/serial/cyberjack.c3
-rw-r--r--drivers/usb/serial/cypress_m8.c3
-rw-r--r--drivers/usb/serial/digi_acceleport.c2
-rw-r--r--drivers/usb/serial/empeg.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.h1
-rw-r--r--drivers/usb/serial/funsoft.c1
-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.c417
-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.c2
-rw-r--r--drivers/usb/serial/io_usbvend.h5
-rw-r--r--drivers/usb/serial/ipaq.c1
-rw-r--r--drivers/usb/serial/ipw.c1
-rw-r--r--drivers/usb/serial/ir-usb.c1
-rw-r--r--drivers/usb/serial/keyspan.c49
-rw-r--r--drivers/usb/serial/keyspan.h7
-rw-r--r--drivers/usb/serial/keyspan_pda.c3
-rw-r--r--drivers/usb/serial/kl5kusb105.c1
-rw-r--r--drivers/usb/serial/kobil_sct.c1
-rw-r--r--drivers/usb/serial/mct_u232.c1
-rw-r--r--drivers/usb/serial/mos7720.c16
-rw-r--r--drivers/usb/serial/mos7840.c16
-rw-r--r--drivers/usb/serial/navman.c1
-rw-r--r--drivers/usb/serial/omninet.c1
-rw-r--r--drivers/usb/serial/option.c1
-rw-r--r--drivers/usb/serial/pl2303.c1
-rw-r--r--drivers/usb/serial/safe_serial.c1
-rw-r--r--drivers/usb/serial/sierra.c29
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c2
-rw-r--r--drivers/usb/serial/usb-serial.c102
-rw-r--r--drivers/usb/serial/visor.c6
-rw-r--r--drivers/usb/serial/visor.h1
-rw-r--r--drivers/usb/serial/whiteheat.c2
43 files changed, 687 insertions, 177 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 f2ca76a9cbac..0af42e32fa0a 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -277,6 +277,7 @@ static struct usb_serial_driver airprime_device = {
277 .owner = THIS_MODULE, 277 .owner = THIS_MODULE,
278 .name = "airprime", 278 .name = "airprime",
279 }, 279 },
280 .usb_driver = &airprime_driver,
280 .id_table = id_table, 281 .id_table = id_table,
281 .num_interrupt_in = NUM_DONT_CARE, 282 .num_interrupt_in = NUM_DONT_CARE,
282 .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 5261cd22ee6b..edd685791a6b 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -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 38b4dae319ee..3b800d277c4b 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -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,
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/cp2101.c b/drivers/usb/serial/cp2101.c
index 7ebaffd6ed86..3ec24870bca9 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -89,6 +89,7 @@ static struct usb_serial_driver cp2101_device = {
89 .owner = THIS_MODULE, 89 .owner = THIS_MODULE,
90 .name = "cp2101", 90 .name = "cp2101",
91 }, 91 },
92 .usb_driver = &cp2101_driver,
92 .id_table = id_table, 93 .id_table = id_table,
93 .num_interrupt_in = 0, 94 .num_interrupt_in = 0,
94 .num_bulk_in = 0, 95 .num_bulk_in = 0,
@@ -169,13 +170,13 @@ static int cp2101_get_config(struct usb_serial_port* port, u8 request,
169 unsigned int *data, int size) 170 unsigned int *data, int size)
170{ 171{
171 struct usb_serial *serial = port->serial; 172 struct usb_serial *serial = port->serial;
172 u32 *buf; 173 __le32 *buf;
173 int result, i, length; 174 int result, i, length;
174 175
175 /* Number of integers required to contain the array */ 176 /* Number of integers required to contain the array */
176 length = (((size - 1) | 3) + 1)/4; 177 length = (((size - 1) | 3) + 1)/4;
177 178
178 buf = kcalloc(length, sizeof(u32), GFP_KERNEL); 179 buf = kcalloc(length, sizeof(__le32), GFP_KERNEL);
179 if (!buf) { 180 if (!buf) {
180 dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__); 181 dev_err(&port->dev, "%s - out of memory.\n", __FUNCTION__);
181 return -ENOMEM; 182 return -ENOMEM;
@@ -215,13 +216,13 @@ static int cp2101_set_config(struct usb_serial_port* port, u8 request,
215 unsigned int *data, int size) 216 unsigned int *data, int size)
216{ 217{
217 struct usb_serial *serial = port->serial; 218 struct usb_serial *serial = port->serial;
218 u32 *buf; 219 __le32 *buf;
219 int result, i, length; 220 int result, i, length;
220 221
221 /* Number of integers required to contain the array */ 222 /* Number of integers required to contain the array */
222 length = (((size - 1) | 3) + 1)/4; 223 length = (((size - 1) | 3) + 1)/4;
223 224
224 buf = kmalloc(length * sizeof(u32), GFP_KERNEL); 225 buf = kmalloc(length * sizeof(__le32), GFP_KERNEL);
225 if (!buf) { 226 if (!buf) {
226 dev_err(&port->dev, "%s - out of memory.\n", 227 dev_err(&port->dev, "%s - out of memory.\n",
227 __FUNCTION__); 228 __FUNCTION__);
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 6bc1f404e186..57b8e27285fc 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -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,
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index efd9ce3f931f..0b0fb51bad3e 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -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,
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index 92beeb19795f..4703c8f85383 100644
--- a/drivers/usb/serial/empeg.c
+++ b/drivers/usb/serial/empeg.c
@@ -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,
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 6986e756f7c0..4695952b6470 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -464,7 +464,6 @@ static struct usb_device_id id_table_combined [] = {
464 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, 464 { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
465 { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, 465 { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) },
466 { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) }, 466 { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) },
467 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID) },
468 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, 467 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) },
469 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, 468 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) },
470 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) }, 469 { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) },
@@ -615,6 +614,7 @@ static struct usb_serial_driver ftdi_sio_device = {
615 .name = "ftdi_sio", 614 .name = "ftdi_sio",
616 }, 615 },
617 .description = "FTDI USB Serial Device", 616 .description = "FTDI USB Serial Device",
617 .usb_driver = &ftdi_driver ,
618 .id_table = id_table_combined, 618 .id_table = id_table_combined,
619 .num_interrupt_in = 0, 619 .num_interrupt_in = 0,
620 .num_bulk_in = 1, 620 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 40dd394de58d..7eff1c03ba80 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -364,7 +364,6 @@
364 * 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
365 * and I'm not entirely sure which are used by which. 365 * and I'm not entirely sure which are used by which.
366 */ 366 */
367#define FTDI_4N_GALAXY_DE_0_PID 0x8372
368#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0 367#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0
369#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1 368#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1
370 369
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c
index 2bebd63d5ed1..4092f6dc9efd 100644
--- a/drivers/usb/serial/funsoft.c
+++ b/drivers/usb/serial/funsoft.c
@@ -58,6 +58,7 @@ static struct usb_serial_driver funsoft_device = {
58 .name = "funsoft", 58 .name = "funsoft",
59 }, 59 },
60 .id_table = id_table, 60 .id_table = id_table,
61 .usb_driver = &funsoft_driver,
61 .num_interrupt_in = NUM_DONT_CARE, 62 .num_interrupt_in = NUM_DONT_CARE,
62 .num_bulk_in = NUM_DONT_CARE, 63 .num_bulk_in = NUM_DONT_CARE,
63 .num_bulk_out = NUM_DONT_CARE, 64 .num_bulk_out = NUM_DONT_CARE,
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 f623d58370a4..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 */
@@ -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);
@@ -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;
@@ -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 ) {
@@ -2414,6 +2510,7 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r
2414#endif 2510#endif
2415static void change_port_settings (struct edgeport_port *edge_port, struct ktermios *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 ktermi
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 ktermi
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 980285c0233a..544098d2b775 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -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 42f757a5b876..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,
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 8fdf486e3465..9d847f69291c 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -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,
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 9d2fdfd6865f..e6966f12ed5a 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -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 6413d73c139c..c6830cbdc6df 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -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 126b9703bbaf..da514cb785b3 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -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 5c4b06a99ac0..b2097c45a235 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -124,6 +124,7 @@ static struct usb_serial_driver kl5kusb105d_device = {
124 .name = "kl5kusb105d", 124 .name = "kl5kusb105d",
125 }, 125 },
126 .description = "KL5KUSB105D / PalmConnect", 126 .description = "KL5KUSB105D / PalmConnect",
127 .usb_driver = &kl5kusb105d_driver,
127 .id_table = id_table, 128 .id_table = id_table,
128 .num_interrupt_in = 1, 129 .num_interrupt_in = 1,
129 .num_bulk_in = 1, 130 .num_bulk_in = 1,
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 62bea0c923bd..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,
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 38b1d17e06ef..4cd839b1407f 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -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,
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index e55f4ed81d7b..6109c6704a73 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -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 83f661403ba1..b2264a87617b 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2834,12 +2834,21 @@ static void mos7840_shutdown(struct usb_serial *serial)
2834 2834
2835} 2835}
2836 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
2837static struct usb_serial_driver moschip7840_4port_device = { 2845static struct usb_serial_driver moschip7840_4port_device = {
2838 .driver = { 2846 .driver = {
2839 .owner = THIS_MODULE, 2847 .owner = THIS_MODULE,
2840 .name = "mos7840", 2848 .name = "mos7840",
2841 }, 2849 },
2842 .description = DRIVER_DESC, 2850 .description = DRIVER_DESC,
2851 .usb_driver = &io_driver,
2843 .id_table = moschip_port_id_table, 2852 .id_table = moschip_port_id_table,
2844 .num_interrupt_in = 1, //NUM_DONT_CARE,//1, 2853 .num_interrupt_in = 1, //NUM_DONT_CARE,//1,
2845#ifdef check 2854#ifdef check
@@ -2869,13 +2878,6 @@ static struct usb_serial_driver moschip7840_4port_device = {
2869 .read_int_callback = mos7840_interrupt_callback, 2878 .read_int_callback = mos7840_interrupt_callback,
2870}; 2879};
2871 2880
2872static struct usb_driver io_driver = {
2873 .name = "mos7840",
2874 .probe = usb_serial_probe,
2875 .disconnect = usb_serial_disconnect,
2876 .id_table = moschip_id_table_combined,
2877};
2878
2879/**************************************************************************** 2881/****************************************************************************
2880 * moschip7840_init 2882 * moschip7840_init
2881 * 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 0fed43a96871..ced9f32b29d9 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -135,6 +135,7 @@ static struct usb_serial_driver option_1port_device = {
135 .name = "option1", 135 .name = "option1",
136 }, 136 },
137 .description = "GSM modem (1-port)", 137 .description = "GSM modem (1-port)",
138 .usb_driver = &option_driver,
138 .id_table = option_ids1, 139 .id_table = option_ids1,
139 .num_interrupt_in = NUM_DONT_CARE, 140 .num_interrupt_in = NUM_DONT_CARE,
140 .num_bulk_in = NUM_DONT_CARE, 141 .num_bulk_in = NUM_DONT_CARE,
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 5dc2ac9afa90..6c083d4e2c9b 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -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 6d8e91e00ecf..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
@@ -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 83189005c6fb..4203e2b1a761 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -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,
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 716f6806cc89..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 }
@@ -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 b09f06096056..2f59ff226e2c 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -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,
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 5483d8564c1b..bf16e9e1d84e 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -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,