aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2009-06-15 21:08:07 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-06-15 21:08:07 -0400
commit7eef4091a653c243a87e5375c54504cc03bec4d8 (patch)
treef65b77f830b2c8f7d014512badfef5df0d591ee9 /drivers/usb/serial
parent0a93a47f042c459f0f46942c3a920e3c81878031 (diff)
parent07a2039b8eb0af4ff464efd3dfd95de5c02648c6 (diff)
Merge commit 'v2.6.30' into for-2.6.31
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/cyberjack.c7
-rw-r--r--drivers/usb/serial/cypress_m8.c4
-rw-r--r--drivers/usb/serial/empeg.c6
-rw-r--r--drivers/usb/serial/ftdi_sio.c27
-rw-r--r--drivers/usb/serial/ftdi_sio.h6
-rw-r--r--drivers/usb/serial/garmin_gps.c8
-rw-r--r--drivers/usb/serial/generic.c6
-rw-r--r--drivers/usb/serial/io_edgeport.c8
-rw-r--r--drivers/usb/serial/io_ti.c8
-rw-r--r--drivers/usb/serial/ipaq.c6
-rw-r--r--drivers/usb/serial/ipw.c3
-rw-r--r--drivers/usb/serial/iuu_phoenix.c1
-rw-r--r--drivers/usb/serial/kobil_sct.c6
-rw-r--r--drivers/usb/serial/mos7720.c7
-rw-r--r--drivers/usb/serial/mos7840.c43
-rw-r--r--drivers/usb/serial/opticon.c8
-rw-r--r--drivers/usb/serial/option.c3
-rw-r--r--drivers/usb/serial/sierra.c24
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c14
-rw-r--r--drivers/usb/serial/usb-serial.c105
-rw-r--r--drivers/usb/serial/visor.c8
21 files changed, 135 insertions, 173 deletions
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index 858bdd038fb..dd501bb63ed 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -175,13 +175,6 @@ static int cyberjack_open(struct tty_struct *tty,
175 dbg("%s - usb_clear_halt", __func__); 175 dbg("%s - usb_clear_halt", __func__);
176 usb_clear_halt(port->serial->dev, port->write_urb->pipe); 176 usb_clear_halt(port->serial->dev, port->write_urb->pipe);
177 177
178 /* force low_latency on so that our tty_push actually forces
179 * the data through, otherwise it is scheduled, and with high
180 * data rates (like with OHCI) data can get lost.
181 */
182 if (tty)
183 tty->low_latency = 1;
184
185 priv = usb_get_serial_port_data(port); 178 priv = usb_get_serial_port_data(port);
186 spin_lock_irqsave(&priv->lock, flags); 179 spin_lock_irqsave(&priv->lock, flags);
187 priv->rdtodo = 0; 180 priv->rdtodo = 0;
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index eae4740d448..e568710b263 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -656,10 +656,6 @@ static int cypress_open(struct tty_struct *tty,
656 priv->rx_flags = 0; 656 priv->rx_flags = 0;
657 spin_unlock_irqrestore(&priv->lock, flags); 657 spin_unlock_irqrestore(&priv->lock, flags);
658 658
659 /* setting to zero could cause data loss */
660 if (tty)
661 tty->low_latency = 1;
662
663 /* raise both lines and set termios */ 659 /* raise both lines and set termios */
664 spin_lock_irqsave(&priv->lock, flags); 660 spin_lock_irqsave(&priv->lock, flags);
665 priv->line_control = CONTROL_DTR | CONTROL_RTS; 661 priv->line_control = CONTROL_DTR | CONTROL_RTS;
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index 8a69cce40b6..c709ec474a8 100644
--- a/drivers/usb/serial/empeg.c
+++ b/drivers/usb/serial/empeg.c
@@ -478,12 +478,6 @@ static void empeg_set_termios(struct tty_struct *tty,
478 termios->c_cflag 478 termios->c_cflag
479 |= CS8; /* character size 8 bits */ 479 |= CS8; /* character size 8 bits */
480 480
481 /*
482 * Force low_latency on; otherwise the pushes are scheduled;
483 * this is bad as it opens up the possibility of dropping bytes
484 * on the floor. We don't want to drop bytes on the floor. :)
485 */
486 tty->low_latency = 1;
487 tty_encode_baud_rate(tty, 115200, 115200); 481 tty_encode_baud_rate(tty, 115200, 115200);
488} 482}
489 483
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 8100f1d2590..d9fcdaedf38 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -56,6 +56,7 @@ static __u16 vendor = FTDI_VID;
56static __u16 product; 56static __u16 product;
57 57
58struct ftdi_private { 58struct ftdi_private {
59 struct kref kref;
59 ftdi_chip_type_t chip_type; 60 ftdi_chip_type_t chip_type;
60 /* type of device, either SIO or FT8U232AM */ 61 /* type of device, either SIO or FT8U232AM */
61 int baud_base; /* baud base clock for divisor setting */ 62 int baud_base; /* baud base clock for divisor setting */
@@ -669,6 +670,8 @@ static struct usb_device_id id_table_combined [] = {
669 { USB_DEVICE(ADI_VID, ADI_GNICE_PID), 670 { USB_DEVICE(ADI_VID, ADI_GNICE_PID),
670 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 671 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
671 { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, 672 { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) },
673 { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID),
674 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
672 { }, /* Optional parameter entry */ 675 { }, /* Optional parameter entry */
673 { } /* Terminating entry */ 676 { } /* Terminating entry */
674}; 677};
@@ -1352,6 +1355,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
1352 return -ENOMEM; 1355 return -ENOMEM;
1353 } 1356 }
1354 1357
1358 kref_init(&priv->kref);
1355 spin_lock_init(&priv->rx_lock); 1359 spin_lock_init(&priv->rx_lock);
1356 spin_lock_init(&priv->tx_lock); 1360 spin_lock_init(&priv->tx_lock);
1357 init_waitqueue_head(&priv->delta_msr_wait); 1361 init_waitqueue_head(&priv->delta_msr_wait);
@@ -1468,6 +1472,13 @@ static void ftdi_shutdown(struct usb_serial *serial)
1468 dbg("%s", __func__); 1472 dbg("%s", __func__);
1469} 1473}
1470 1474
1475static void ftdi_sio_priv_release(struct kref *k)
1476{
1477 struct ftdi_private *priv = container_of(k, struct ftdi_private, kref);
1478
1479 kfree(priv);
1480}
1481
1471static int ftdi_sio_port_remove(struct usb_serial_port *port) 1482static int ftdi_sio_port_remove(struct usb_serial_port *port)
1472{ 1483{
1473 struct ftdi_private *priv = usb_get_serial_port_data(port); 1484 struct ftdi_private *priv = usb_get_serial_port_data(port);
@@ -1476,14 +1487,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port)
1476 1487
1477 remove_sysfs_attrs(port); 1488 remove_sysfs_attrs(port);
1478 1489
1479 /* all open ports are closed at this point 1490 kref_put(&priv->kref, ftdi_sio_priv_release);
1480 * (by usbserial.c:__serial_close, which calls ftdi_close)
1481 */
1482
1483 if (priv) {
1484 usb_set_serial_port_data(port, NULL);
1485 kfree(priv);
1486 }
1487 1491
1488 return 0; 1492 return 0;
1489} 1493}
@@ -1547,7 +1551,8 @@ static int ftdi_open(struct tty_struct *tty,
1547 dev_err(&port->dev, 1551 dev_err(&port->dev,
1548 "%s - failed submitting read urb, error %d\n", 1552 "%s - failed submitting read urb, error %d\n",
1549 __func__, result); 1553 __func__, result);
1550 1554 else
1555 kref_get(&priv->kref);
1551 1556
1552 return result; 1557 return result;
1553} /* ftdi_open */ 1558} /* ftdi_open */
@@ -1589,11 +1594,11 @@ static void ftdi_close(struct tty_struct *tty,
1589 mutex_unlock(&port->serial->disc_mutex); 1594 mutex_unlock(&port->serial->disc_mutex);
1590 1595
1591 /* cancel any scheduled reading */ 1596 /* cancel any scheduled reading */
1592 cancel_delayed_work(&priv->rx_work); 1597 cancel_delayed_work_sync(&priv->rx_work);
1593 flush_scheduled_work();
1594 1598
1595 /* shutdown our bulk read */ 1599 /* shutdown our bulk read */
1596 usb_kill_urb(port->read_urb); 1600 usb_kill_urb(port->read_urb);
1601 kref_put(&priv->kref, ftdi_sio_priv_release);
1597} /* ftdi_close */ 1602} /* ftdi_close */
1598 1603
1599 1604
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index c09f658a448..12330fa1c09 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -920,6 +920,12 @@
920#define JETI_SPC1201_PID 0x04b2 920#define JETI_SPC1201_PID 0x04b2
921 921
922/* 922/*
923 * Marvell SheevaPlug
924 */
925#define MARVELL_VID 0x9e88
926#define MARVELL_SHEEVAPLUG_PID 0x9e8f
927
928/*
923 * BmRequestType: 1100 0000b 929 * BmRequestType: 1100 0000b
924 * bRequest: FTDI_E2_READ 930 * bRequest: FTDI_E2_READ
925 * wValue: 0 931 * wValue: 0
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index a26a0e2cdb4..586d30ff450 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -973,14 +973,6 @@ static int garmin_open(struct tty_struct *tty,
973 973
974 dbg("%s - port %d", __func__, port->number); 974 dbg("%s - port %d", __func__, port->number);
975 975
976 /*
977 * Force low_latency on so that our tty_push actually forces the data
978 * through, otherwise it is scheduled, and with high data rates (like
979 * with OHCI) data can get lost.
980 */
981 if (tty)
982 tty->low_latency = 1;
983
984 spin_lock_irqsave(&garmin_data_p->lock, flags); 976 spin_lock_irqsave(&garmin_data_p->lock, flags);
985 garmin_data_p->mode = initial_mode; 977 garmin_data_p->mode = initial_mode;
986 garmin_data_p->count = 0; 978 garmin_data_p->count = 0;
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 9d57cace373..4cec9906ccf 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -122,12 +122,6 @@ int usb_serial_generic_open(struct tty_struct *tty,
122 122
123 dbg("%s - port %d", __func__, port->number); 123 dbg("%s - port %d", __func__, port->number);
124 124
125 /* force low_latency on so that our tty_push actually forces the data
126 through, otherwise it is scheduled, and with high data rates (like
127 with OHCI) data can get lost. */
128 if (tty)
129 tty->low_latency = 1;
130
131 /* clear the throttle flags */ 125 /* clear the throttle flags */
132 spin_lock_irqsave(&port->lock, flags); 126 spin_lock_irqsave(&port->lock, flags);
133 port->throttled = 0; 127 port->throttled = 0;
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index e85c8c0d1ad..fb4a73d090f 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -193,8 +193,6 @@ static const struct divisor_table_entry divisor_table[] = {
193/* local variables */ 193/* local variables */
194static int debug; 194static int debug;
195 195
196static int low_latency = 1; /* tty low latency flag, on by default */
197
198static atomic_t CmdUrbs; /* Number of outstanding Command Write Urbs */ 196static atomic_t CmdUrbs; /* Number of outstanding Command Write Urbs */
199 197
200 198
@@ -867,9 +865,6 @@ static int edge_open(struct tty_struct *tty,
867 if (edge_port == NULL) 865 if (edge_port == NULL)
868 return -ENODEV; 866 return -ENODEV;
869 867
870 if (tty)
871 tty->low_latency = low_latency;
872
873 /* see if we've set up our endpoint info yet (can't set it up 868 /* see if we've set up our endpoint info yet (can't set it up
874 in edge_startup as the structures were not set up at that time.) */ 869 in edge_startup as the structures were not set up at that time.) */
875 serial = port->serial; 870 serial = port->serial;
@@ -3299,6 +3294,3 @@ MODULE_FIRMWARE("edgeport/down2.fw");
3299 3294
3300module_param(debug, bool, S_IRUGO | S_IWUSR); 3295module_param(debug, bool, S_IRUGO | S_IWUSR);
3301MODULE_PARM_DESC(debug, "Debug enabled or not"); 3296MODULE_PARM_DESC(debug, "Debug enabled or not");
3302
3303module_param(low_latency, bool, S_IRUGO | S_IWUSR);
3304MODULE_PARM_DESC(low_latency, "Low latency enabled or not");
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index c3cdd00ddc4..513b25e044c 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -76,7 +76,6 @@ struct edgeport_uart_buf_desc {
76#define EDGE_READ_URB_STOPPING 1 76#define EDGE_READ_URB_STOPPING 1
77#define EDGE_READ_URB_STOPPED 2 77#define EDGE_READ_URB_STOPPED 2
78 78
79#define EDGE_LOW_LATENCY 1
80#define EDGE_CLOSING_WAIT 4000 /* in .01 sec */ 79#define EDGE_CLOSING_WAIT 4000 /* in .01 sec */
81 80
82#define EDGE_OUT_BUF_SIZE 1024 81#define EDGE_OUT_BUF_SIZE 1024
@@ -232,7 +231,6 @@ static unsigned short OperationalBuildNumber;
232 231
233static int debug; 232static int debug;
234 233
235static int low_latency = EDGE_LOW_LATENCY;
236static int closing_wait = EDGE_CLOSING_WAIT; 234static int closing_wait = EDGE_CLOSING_WAIT;
237static int ignore_cpu_rev; 235static int ignore_cpu_rev;
238static int default_uart_mode; /* RS232 */ 236static int default_uart_mode; /* RS232 */
@@ -1850,9 +1848,6 @@ static int edge_open(struct tty_struct *tty,
1850 if (edge_port == NULL) 1848 if (edge_port == NULL)
1851 return -ENODEV; 1849 return -ENODEV;
1852 1850
1853 if (tty)
1854 tty->low_latency = low_latency;
1855
1856 port_number = port->number - port->serial->minor; 1851 port_number = port->number - port->serial->minor;
1857 switch (port_number) { 1852 switch (port_number) {
1858 case 0: 1853 case 0:
@@ -3008,9 +3003,6 @@ MODULE_FIRMWARE("edgeport/down3.bin");
3008module_param(debug, bool, S_IRUGO | S_IWUSR); 3003module_param(debug, bool, S_IRUGO | S_IWUSR);
3009MODULE_PARM_DESC(debug, "Debug enabled or not"); 3004MODULE_PARM_DESC(debug, "Debug enabled or not");
3010 3005
3011module_param(low_latency, bool, S_IRUGO | S_IWUSR);
3012MODULE_PARM_DESC(low_latency, "Low latency enabled or not");
3013
3014module_param(closing_wait, int, S_IRUGO | S_IWUSR); 3006module_param(closing_wait, int, S_IRUGO | S_IWUSR);
3015MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs"); 3007MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs");
3016 3008
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index ef92095b073..cd62825a9ac 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -631,13 +631,7 @@ static int ipaq_open(struct tty_struct *tty,
631 priv->free_len += PACKET_SIZE; 631 priv->free_len += PACKET_SIZE;
632 } 632 }
633 633
634 /*
635 * Force low latency on. This will immediately push data to the line
636 * discipline instead of queueing.
637 */
638
639 if (tty) { 634 if (tty) {
640 tty->low_latency = 1;
641 /* FIXME: These two are bogus */ 635 /* FIXME: These two are bogus */
642 tty->raw = 1; 636 tty->raw = 1;
643 tty->real_raw = 1; 637 tty->real_raw = 1;
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index f530032ed93..da2a2b46644 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -207,9 +207,6 @@ static int ipw_open(struct tty_struct *tty,
207 if (!buf_flow_init) 207 if (!buf_flow_init)
208 return -ENOMEM; 208 return -ENOMEM;
209 209
210 if (tty)
211 tty->low_latency = 1;
212
213 /* --1: Tell the modem to initialize (we think) From sniffs this is 210 /* --1: Tell the modem to initialize (we think) From sniffs this is
214 * always the first thing that gets sent to the modem during 211 * always the first thing that gets sent to the modem during
215 * opening of the device */ 212 * opening of the device */
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 2314c6ae4fc..4473d442b2a 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -1051,7 +1051,6 @@ static int iuu_open(struct tty_struct *tty,
1051 tty->termios->c_oflag = 0; 1051 tty->termios->c_oflag = 0;
1052 tty->termios->c_iflag = 0; 1052 tty->termios->c_iflag = 0;
1053 priv->termios_initialized = 1; 1053 priv->termios_initialized = 1;
1054 tty->low_latency = 1;
1055 priv->poll = 0; 1054 priv->poll = 0;
1056 } 1055 }
1057 spin_unlock_irqrestore(&priv->lock, flags); 1056 spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 6286baad939..c148544953b 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -231,13 +231,7 @@ static int kobil_open(struct tty_struct *tty,
231 /* someone sets the dev to 0 if the close method has been called */ 231 /* someone sets the dev to 0 if the close method has been called */
232 port->interrupt_in_urb->dev = port->serial->dev; 232 port->interrupt_in_urb->dev = port->serial->dev;
233 233
234
235 /* force low_latency on so that our tty_push actually forces
236 * the data through, otherwise it is scheduled, and with high
237 * data rates (like with OHCI) data can get lost.
238 */
239 if (tty) { 234 if (tty) {
240 tty->low_latency = 1;
241 235
242 /* Default to echo off and other sane device settings */ 236 /* Default to echo off and other sane device settings */
243 tty->termios->c_lflag = 0; 237 tty->termios->c_lflag = 0;
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index e772cc0a97f..24e3b5d4b4d 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -446,13 +446,6 @@ static int mos7720_open(struct tty_struct *tty,
446 data = 0x0c; 446 data = 0x0c;
447 send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data); 447 send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data);
448 448
449 /* force low_latency on so that our tty_push actually forces *
450 * the data through,otherwise it is scheduled, and with *
451 * high data rates (like with OHCI) data can get lost. */
452
453 if (tty)
454 tty->low_latency = 1;
455
456 /* see if we've set up our endpoint info yet * 449 /* see if we've set up our endpoint info yet *
457 * (can't set it up in mos7720_startup as the * 450 * (can't set it up in mos7720_startup as the *
458 * structures were not set up at that time.) */ 451 * structures were not set up at that time.) */
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 2c20e88a91b..84fb1dcd30d 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -38,7 +38,7 @@
38/* 38/*
39 * Version Information 39 * Version Information
40 */ 40 */
41#define DRIVER_VERSION "1.3.1" 41#define DRIVER_VERSION "1.3.2"
42#define DRIVER_DESC "Moschip 7840/7820 USB Serial Driver" 42#define DRIVER_DESC "Moschip 7840/7820 USB Serial Driver"
43 43
44/* 44/*
@@ -123,6 +123,11 @@
123#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 123#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44
124#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42 124#define BANDB_DEVICE_ID_USOPTL4_2 0xAC42
125 125
126/* This driver also supports the ATEN UC2324 device since it is mos7840 based
127 * - if I knew the device id it would also support the ATEN UC2322 */
128#define USB_VENDOR_ID_ATENINTL 0x0557
129#define ATENINTL_DEVICE_ID_UC2324 0x2011
130
126/* Interrupt Routine Defines */ 131/* Interrupt Routine Defines */
127 132
128#define SERIAL_IIR_RLS 0x06 133#define SERIAL_IIR_RLS 0x06
@@ -170,6 +175,7 @@ static struct usb_device_id moschip_port_id_table[] = {
170 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, 175 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
171 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, 176 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
172 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, 177 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)},
178 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)},
173 {} /* terminating entry */ 179 {} /* terminating entry */
174}; 180};
175 181
@@ -178,6 +184,7 @@ static __devinitdata struct usb_device_id moschip_id_table_combined[] = {
178 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, 184 {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
179 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, 185 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
180 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, 186 {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)},
187 {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)},
181 {} /* terminating entry */ 188 {} /* terminating entry */
182}; 189};
183 190
@@ -1000,12 +1007,6 @@ static int mos7840_open(struct tty_struct *tty,
1000 status = mos7840_set_reg_sync(port, mos7840_port->ControlRegOffset, 1007 status = mos7840_set_reg_sync(port, mos7840_port->ControlRegOffset,
1001 Data); 1008 Data);
1002 1009
1003 /* force low_latency on so that our tty_push actually forces *
1004 * the data through,otherwise it is scheduled, and with *
1005 * high data rates (like with OHCI) data can get lost. */
1006 if (tty)
1007 tty->low_latency = 1;
1008
1009 /* Check to see if we've set up our endpoint info yet * 1010 /* Check to see if we've set up our endpoint info yet *
1010 * (can't set it up in mos7840_startup as the structures * 1011 * (can't set it up in mos7840_startup as the structures *
1011 * were not set up at that time.) */ 1012 * were not set up at that time.) */
@@ -2477,9 +2478,14 @@ static int mos7840_startup(struct usb_serial *serial)
2477 mos7840_set_port_private(serial->port[i], mos7840_port); 2478 mos7840_set_port_private(serial->port[i], mos7840_port);
2478 spin_lock_init(&mos7840_port->pool_lock); 2479 spin_lock_init(&mos7840_port->pool_lock);
2479 2480
2480 mos7840_port->port_num = ((serial->port[i]->number - 2481 /* minor is not initialised until later by
2481 (serial->port[i]->serial->minor)) + 2482 * usb-serial.c:get_free_serial() and cannot therefore be used
2482 1); 2483 * to index device instances */
2484 mos7840_port->port_num = i + 1;
2485 dbg ("serial->port[i]->number = %d", serial->port[i]->number);
2486 dbg ("serial->port[i]->serial->minor = %d", serial->port[i]->serial->minor);
2487 dbg ("mos7840_port->port_num = %d", mos7840_port->port_num);
2488 dbg ("serial->minor = %d", serial->minor);
2483 2489
2484 if (mos7840_port->port_num == 1) { 2490 if (mos7840_port->port_num == 1) {
2485 mos7840_port->SpRegOffset = 0x0; 2491 mos7840_port->SpRegOffset = 0x0;
@@ -2690,13 +2696,16 @@ static void mos7840_shutdown(struct usb_serial *serial)
2690 2696
2691 for (i = 0; i < serial->num_ports; ++i) { 2697 for (i = 0; i < serial->num_ports; ++i) {
2692 mos7840_port = mos7840_get_port_private(serial->port[i]); 2698 mos7840_port = mos7840_get_port_private(serial->port[i]);
2693 spin_lock_irqsave(&mos7840_port->pool_lock, flags); 2699 dbg ("mos7840_port %d = %p", i, mos7840_port);
2694 mos7840_port->zombie = 1; 2700 if (mos7840_port) {
2695 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); 2701 spin_lock_irqsave(&mos7840_port->pool_lock, flags);
2696 usb_kill_urb(mos7840_port->control_urb); 2702 mos7840_port->zombie = 1;
2697 kfree(mos7840_port->ctrl_buf); 2703 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
2698 kfree(mos7840_port->dr); 2704 usb_kill_urb(mos7840_port->control_urb);
2699 kfree(mos7840_port); 2705 kfree(mos7840_port->ctrl_buf);
2706 kfree(mos7840_port->dr);
2707 kfree(mos7840_port);
2708 }
2700 mos7840_set_port_private(serial->port[i], NULL); 2709 mos7840_set_port_private(serial->port[i], NULL);
2701 } 2710 }
2702 2711
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index 839583dc8b6..b500ad10b75 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -159,14 +159,6 @@ static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port,
159 priv->port = port; 159 priv->port = port;
160 spin_unlock_irqrestore(&priv->lock, flags); 160 spin_unlock_irqrestore(&priv->lock, flags);
161 161
162 /*
163 * Force low_latency on so that our tty_push actually forces the data
164 * through, otherwise it is scheduled, and with high data rates (like
165 * with OHCI) data can get lost.
166 */
167 if (tty)
168 tty->low_latency = 1;
169
170 /* Start reading from the device */ 162 /* Start reading from the device */
171 usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev, 163 usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev,
172 usb_rcvbulkpipe(priv->udev, 164 usb_rcvbulkpipe(priv->udev,
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 47bd070f24b..7817b82889c 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -936,9 +936,6 @@ static int option_open(struct tty_struct *tty,
936 usb_pipeout(urb->pipe), 0); */ 936 usb_pipeout(urb->pipe), 0); */
937 } 937 }
938 938
939 if (tty)
940 tty->low_latency = 1;
941
942 option_send_setup(tty, port); 939 option_send_setup(tty, port);
943 940
944 return 0; 941 return 0;
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index d9bf9a5c20e..913225c6161 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -14,7 +14,7 @@
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 16
17#define DRIVER_VERSION "v.1.3.2" 17#define DRIVER_VERSION "v.1.3.3"
18#define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>" 18#define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>"
19#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" 19#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems"
20 20
@@ -259,9 +259,21 @@ static int sierra_send_setup(struct tty_struct *tty,
259 val |= 0x02; 259 val |= 0x02;
260 260
261 /* If composite device then properly report interface */ 261 /* If composite device then properly report interface */
262 if (serial->num_ports == 1) 262 if (serial->num_ports == 1) {
263 interface = sierra_calc_interface(serial); 263 interface = sierra_calc_interface(serial);
264 264
265 /* Control message is sent only to interfaces with
266 * interrupt_in endpoints
267 */
268 if (port->interrupt_in_urb) {
269 /* send control message */
270 return usb_control_msg(serial->dev,
271 usb_rcvctrlpipe(serial->dev, 0),
272 0x22, 0x21, val, interface,
273 NULL, 0, USB_CTRL_SET_TIMEOUT);
274 }
275 }
276
265 /* Otherwise the need to do non-composite mapping */ 277 /* Otherwise the need to do non-composite mapping */
266 else { 278 else {
267 if (port->bulk_out_endpointAddress == 2) 279 if (port->bulk_out_endpointAddress == 2)
@@ -270,12 +282,13 @@ static int sierra_send_setup(struct tty_struct *tty,
270 interface = 1; 282 interface = 1;
271 else if (port->bulk_out_endpointAddress == 5) 283 else if (port->bulk_out_endpointAddress == 5)
272 interface = 2; 284 interface = 2;
273 }
274 285
275 return usb_control_msg(serial->dev, 286 return usb_control_msg(serial->dev,
276 usb_rcvctrlpipe(serial->dev, 0), 287 usb_rcvctrlpipe(serial->dev, 0),
277 0x22, 0x21, val, interface, 288 0x22, 0x21, val, interface,
278 NULL, 0, USB_CTRL_SET_TIMEOUT); 289 NULL, 0, USB_CTRL_SET_TIMEOUT);
290
291 }
279 } 292 }
280 293
281 return 0; 294 return 0;
@@ -585,9 +598,6 @@ static int sierra_open(struct tty_struct *tty,
585 } 598 }
586 } 599 }
587 600
588 if (tty)
589 tty->low_latency = 1;
590
591 sierra_send_setup(tty, port); 601 sierra_send_setup(tty, port);
592 602
593 /* start up the interrupt endpoint if we have one */ 603 /* start up the interrupt endpoint if we have one */
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 9c4c700c7cc..0a64bac306e 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -50,11 +50,10 @@
50 50
51#define TI_TRANSFER_TIMEOUT 2 51#define TI_TRANSFER_TIMEOUT 2
52 52
53#define TI_DEFAULT_LOW_LATENCY 0
54#define TI_DEFAULT_CLOSING_WAIT 4000 /* in .01 secs */ 53#define TI_DEFAULT_CLOSING_WAIT 4000 /* in .01 secs */
55 54
56/* supported setserial flags */ 55/* supported setserial flags */
57#define TI_SET_SERIAL_FLAGS (ASYNC_LOW_LATENCY) 56#define TI_SET_SERIAL_FLAGS 0
58 57
59/* read urb states */ 58/* read urb states */
60#define TI_READ_URB_RUNNING 0 59#define TI_READ_URB_RUNNING 0
@@ -161,7 +160,6 @@ static int ti_buf_get(struct circ_buf *cb, char *buf, int count);
161 160
162/* module parameters */ 161/* module parameters */
163static int debug; 162static int debug;
164static int low_latency = TI_DEFAULT_LOW_LATENCY;
165static int closing_wait = TI_DEFAULT_CLOSING_WAIT; 163static int closing_wait = TI_DEFAULT_CLOSING_WAIT;
166static ushort vendor_3410[TI_EXTRA_VID_PID_COUNT]; 164static ushort vendor_3410[TI_EXTRA_VID_PID_COUNT];
167static unsigned int vendor_3410_count; 165static unsigned int vendor_3410_count;
@@ -296,10 +294,6 @@ MODULE_FIRMWARE("mts_edge.fw");
296module_param(debug, bool, S_IRUGO | S_IWUSR); 294module_param(debug, bool, S_IRUGO | S_IWUSR);
297MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes"); 295MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes");
298 296
299module_param(low_latency, bool, S_IRUGO | S_IWUSR);
300MODULE_PARM_DESC(low_latency,
301 "TTY low_latency flag, 0=off, 1=on, default is off");
302
303module_param(closing_wait, int, S_IRUGO | S_IWUSR); 297module_param(closing_wait, int, S_IRUGO | S_IWUSR);
304MODULE_PARM_DESC(closing_wait, 298MODULE_PARM_DESC(closing_wait,
305 "Maximum wait for data to drain in close, in .01 secs, default is 4000"); 299 "Maximum wait for data to drain in close, in .01 secs, default is 4000");
@@ -448,7 +442,6 @@ static int ti_startup(struct usb_serial *serial)
448 spin_lock_init(&tport->tp_lock); 442 spin_lock_init(&tport->tp_lock);
449 tport->tp_uart_base_addr = (i == 0 ? 443 tport->tp_uart_base_addr = (i == 0 ?
450 TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR); 444 TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR);
451 tport->tp_flags = low_latency ? ASYNC_LOW_LATENCY : 0;
452 tport->tp_closing_wait = closing_wait; 445 tport->tp_closing_wait = closing_wait;
453 init_waitqueue_head(&tport->tp_msr_wait); 446 init_waitqueue_head(&tport->tp_msr_wait);
454 init_waitqueue_head(&tport->tp_write_wait); 447 init_waitqueue_head(&tport->tp_write_wait);
@@ -528,10 +521,6 @@ static int ti_open(struct tty_struct *tty,
528 if (mutex_lock_interruptible(&tdev->td_open_close_lock)) 521 if (mutex_lock_interruptible(&tdev->td_open_close_lock))
529 return -ERESTARTSYS; 522 return -ERESTARTSYS;
530 523
531 if (tty)
532 tty->low_latency =
533 (tport->tp_flags & ASYNC_LOW_LATENCY) ? 1 : 0;
534
535 port_number = port->number - port->serial->minor; 524 port_number = port->number - port->serial->minor;
536 525
537 memset(&(tport->tp_icount), 0x00, sizeof(tport->tp_icount)); 526 memset(&(tport->tp_icount), 0x00, sizeof(tport->tp_icount));
@@ -1454,7 +1443,6 @@ static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport,
1454 return -EFAULT; 1443 return -EFAULT;
1455 1444
1456 tport->tp_flags = new_serial.flags & TI_SET_SERIAL_FLAGS; 1445 tport->tp_flags = new_serial.flags & TI_SET_SERIAL_FLAGS;
1457 tty->low_latency = (tport->tp_flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1458 tport->tp_closing_wait = new_serial.closing_wait; 1446 tport->tp_closing_wait = new_serial.closing_wait;
1459 1447
1460 return 0; 1448 return 0;
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 2a70563bbee..f331e2bde88 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -137,22 +137,10 @@ static void destroy_serial(struct kref *kref)
137 137
138 dbg("%s - %s", __func__, serial->type->description); 138 dbg("%s - %s", __func__, serial->type->description);
139 139
140 serial->type->shutdown(serial);
141
142 /* return the minor range that this device had */ 140 /* return the minor range that this device had */
143 if (serial->minor != SERIAL_TTY_NO_MINOR) 141 if (serial->minor != SERIAL_TTY_NO_MINOR)
144 return_serial(serial); 142 return_serial(serial);
145 143
146 for (i = 0; i < serial->num_ports; ++i)
147 serial->port[i]->port.count = 0;
148
149 /* the ports are cleaned up and released in port_release() */
150 for (i = 0; i < serial->num_ports; ++i)
151 if (serial->port[i]->dev.parent != NULL) {
152 device_unregister(&serial->port[i]->dev);
153 serial->port[i] = NULL;
154 }
155
156 /* If this is a "fake" port, we have to clean it up here, as it will 144 /* If this is a "fake" port, we have to clean it up here, as it will
157 * not get cleaned up in port_release() as it was never registered with 145 * not get cleaned up in port_release() as it was never registered with
158 * the driver core */ 146 * the driver core */
@@ -187,7 +175,7 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
187 struct usb_serial *serial; 175 struct usb_serial *serial;
188 struct usb_serial_port *port; 176 struct usb_serial_port *port;
189 unsigned int portNumber; 177 unsigned int portNumber;
190 int retval; 178 int retval = 0;
191 179
192 dbg("%s", __func__); 180 dbg("%s", __func__);
193 181
@@ -198,21 +186,24 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
198 return -ENODEV; 186 return -ENODEV;
199 } 187 }
200 188
189 mutex_lock(&serial->disc_mutex);
201 portNumber = tty->index - serial->minor; 190 portNumber = tty->index - serial->minor;
202 port = serial->port[portNumber]; 191 port = serial->port[portNumber];
203 if (!port) { 192 if (!port || serial->disconnected)
204 retval = -ENODEV;
205 goto bailout_kref_put;
206 }
207
208 if (port->serial->disconnected) {
209 retval = -ENODEV; 193 retval = -ENODEV;
210 goto bailout_kref_put; 194 else
211 } 195 get_device(&port->dev);
196 /*
197 * Note: Our locking order requirement does not allow port->mutex
198 * to be acquired while serial->disc_mutex is held.
199 */
200 mutex_unlock(&serial->disc_mutex);
201 if (retval)
202 goto bailout_serial_put;
212 203
213 if (mutex_lock_interruptible(&port->mutex)) { 204 if (mutex_lock_interruptible(&port->mutex)) {
214 retval = -ERESTARTSYS; 205 retval = -ERESTARTSYS;
215 goto bailout_kref_put; 206 goto bailout_port_put;
216 } 207 }
217 208
218 ++port->port.count; 209 ++port->port.count;
@@ -232,14 +223,20 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
232 goto bailout_mutex_unlock; 223 goto bailout_mutex_unlock;
233 } 224 }
234 225
235 retval = usb_autopm_get_interface(serial->interface); 226 mutex_lock(&serial->disc_mutex);
227 if (serial->disconnected)
228 retval = -ENODEV;
229 else
230 retval = usb_autopm_get_interface(serial->interface);
236 if (retval) 231 if (retval)
237 goto bailout_module_put; 232 goto bailout_module_put;
233
238 /* only call the device specific open if this 234 /* only call the device specific open if this
239 * is the first time the port is opened */ 235 * is the first time the port is opened */
240 retval = serial->type->open(tty, port, filp); 236 retval = serial->type->open(tty, port, filp);
241 if (retval) 237 if (retval)
242 goto bailout_interface_put; 238 goto bailout_interface_put;
239 mutex_unlock(&serial->disc_mutex);
243 } 240 }
244 241
245 mutex_unlock(&port->mutex); 242 mutex_unlock(&port->mutex);
@@ -248,13 +245,16 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
248bailout_interface_put: 245bailout_interface_put:
249 usb_autopm_put_interface(serial->interface); 246 usb_autopm_put_interface(serial->interface);
250bailout_module_put: 247bailout_module_put:
248 mutex_unlock(&serial->disc_mutex);
251 module_put(serial->type->driver.owner); 249 module_put(serial->type->driver.owner);
252bailout_mutex_unlock: 250bailout_mutex_unlock:
253 port->port.count = 0; 251 port->port.count = 0;
254 tty->driver_data = NULL; 252 tty->driver_data = NULL;
255 tty_port_tty_set(&port->port, NULL); 253 tty_port_tty_set(&port->port, NULL);
256 mutex_unlock(&port->mutex); 254 mutex_unlock(&port->mutex);
257bailout_kref_put: 255bailout_port_put:
256 put_device(&port->dev);
257bailout_serial_put:
258 usb_serial_put(serial); 258 usb_serial_put(serial);
259 return retval; 259 return retval;
260} 260}
@@ -262,6 +262,9 @@ bailout_kref_put:
262static void serial_close(struct tty_struct *tty, struct file *filp) 262static void serial_close(struct tty_struct *tty, struct file *filp)
263{ 263{
264 struct usb_serial_port *port = tty->driver_data; 264 struct usb_serial_port *port = tty->driver_data;
265 struct usb_serial *serial;
266 struct module *owner;
267 int count;
265 268
266 if (!port) 269 if (!port)
267 return; 270 return;
@@ -269,6 +272,8 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
269 dbg("%s - port %d", __func__, port->number); 272 dbg("%s - port %d", __func__, port->number);
270 273
271 mutex_lock(&port->mutex); 274 mutex_lock(&port->mutex);
275 serial = port->serial;
276 owner = serial->type->driver.owner;
272 277
273 if (port->port.count == 0) { 278 if (port->port.count == 0) {
274 mutex_unlock(&port->mutex); 279 mutex_unlock(&port->mutex);
@@ -281,7 +286,7 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
281 * this before we drop the port count. The call is protected 286 * this before we drop the port count. The call is protected
282 * by the port mutex 287 * by the port mutex
283 */ 288 */
284 port->serial->type->close(tty, port, filp); 289 serial->type->close(tty, port, filp);
285 290
286 if (port->port.count == (port->console ? 2 : 1)) { 291 if (port->port.count == (port->console ? 2 : 1)) {
287 struct tty_struct *tty = tty_port_tty_get(&port->port); 292 struct tty_struct *tty = tty_port_tty_get(&port->port);
@@ -295,17 +300,23 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
295 } 300 }
296 } 301 }
297 302
298 if (port->port.count == 1) {
299 mutex_lock(&port->serial->disc_mutex);
300 if (!port->serial->disconnected)
301 usb_autopm_put_interface(port->serial->interface);
302 mutex_unlock(&port->serial->disc_mutex);
303 module_put(port->serial->type->driver.owner);
304 }
305 --port->port.count; 303 --port->port.count;
306 304 count = port->port.count;
307 mutex_unlock(&port->mutex); 305 mutex_unlock(&port->mutex);
308 usb_serial_put(port->serial); 306 put_device(&port->dev);
307
308 /* Mustn't dereference port any more */
309 if (count == 0) {
310 mutex_lock(&serial->disc_mutex);
311 if (!serial->disconnected)
312 usb_autopm_put_interface(serial->interface);
313 mutex_unlock(&serial->disc_mutex);
314 }
315 usb_serial_put(serial);
316
317 /* Mustn't dereference serial any more */
318 if (count == 0)
319 module_put(owner);
309} 320}
310 321
311static int serial_write(struct tty_struct *tty, const unsigned char *buf, 322static int serial_write(struct tty_struct *tty, const unsigned char *buf,
@@ -549,7 +560,13 @@ static void kill_traffic(struct usb_serial_port *port)
549 560
550static void port_free(struct usb_serial_port *port) 561static void port_free(struct usb_serial_port *port)
551{ 562{
563 /*
564 * Stop all the traffic before cancelling the work, so that
565 * nobody will restart it by calling usb_serial_port_softint.
566 */
552 kill_traffic(port); 567 kill_traffic(port);
568 cancel_work_sync(&port->work);
569
553 usb_free_urb(port->read_urb); 570 usb_free_urb(port->read_urb);
554 usb_free_urb(port->write_urb); 571 usb_free_urb(port->write_urb);
555 usb_free_urb(port->interrupt_in_urb); 572 usb_free_urb(port->interrupt_in_urb);
@@ -558,7 +575,6 @@ static void port_free(struct usb_serial_port *port)
558 kfree(port->bulk_out_buffer); 575 kfree(port->bulk_out_buffer);
559 kfree(port->interrupt_in_buffer); 576 kfree(port->interrupt_in_buffer);
560 kfree(port->interrupt_out_buffer); 577 kfree(port->interrupt_out_buffer);
561 flush_scheduled_work(); /* port->work */
562 kfree(port); 578 kfree(port);
563} 579}
564 580
@@ -958,6 +974,7 @@ int usb_serial_probe(struct usb_interface *interface,
958 if (retval > 0) { 974 if (retval > 0) {
959 /* quietly accept this device, but don't bind to a 975 /* quietly accept this device, but don't bind to a
960 serial port as it's about to disappear */ 976 serial port as it's about to disappear */
977 serial->num_ports = 0;
961 goto exit; 978 goto exit;
962 } 979 }
963 } 980 }
@@ -1043,6 +1060,12 @@ void usb_serial_disconnect(struct usb_interface *interface)
1043 usb_set_intfdata(interface, NULL); 1060 usb_set_intfdata(interface, NULL);
1044 /* must set a flag, to signal subdrivers */ 1061 /* must set a flag, to signal subdrivers */
1045 serial->disconnected = 1; 1062 serial->disconnected = 1;
1063 mutex_unlock(&serial->disc_mutex);
1064
1065 /* Unfortunately, many of the sub-drivers expect the port structures
1066 * to exist when their shutdown method is called, so we have to go
1067 * through this awkward two-step unregistration procedure.
1068 */
1046 for (i = 0; i < serial->num_ports; ++i) { 1069 for (i = 0; i < serial->num_ports; ++i) {
1047 port = serial->port[i]; 1070 port = serial->port[i];
1048 if (port) { 1071 if (port) {
@@ -1052,11 +1075,21 @@ void usb_serial_disconnect(struct usb_interface *interface)
1052 tty_kref_put(tty); 1075 tty_kref_put(tty);
1053 } 1076 }
1054 kill_traffic(port); 1077 kill_traffic(port);
1078 cancel_work_sync(&port->work);
1079 device_del(&port->dev);
1080 }
1081 }
1082 serial->type->shutdown(serial);
1083 for (i = 0; i < serial->num_ports; ++i) {
1084 port = serial->port[i];
1085 if (port) {
1086 put_device(&port->dev);
1087 serial->port[i] = NULL;
1055 } 1088 }
1056 } 1089 }
1090
1057 /* let the last holder of this object 1091 /* let the last holder of this object
1058 * cause it to be cleaned up */ 1092 * cause it to be cleaned up */
1059 mutex_unlock(&serial->disc_mutex);
1060 usb_serial_put(serial); 1093 usb_serial_put(serial);
1061 dev_info(dev, "device disconnected\n"); 1094 dev_info(dev, "device disconnected\n");
1062} 1095}
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 4facce3d936..5ac414bda71 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -296,14 +296,6 @@ static int visor_open(struct tty_struct *tty, struct usb_serial_port *port,
296 priv->throttled = 0; 296 priv->throttled = 0;
297 spin_unlock_irqrestore(&priv->lock, flags); 297 spin_unlock_irqrestore(&priv->lock, flags);
298 298
299 /*
300 * Force low_latency on so that our tty_push actually forces the data
301 * through, otherwise it is scheduled, and with high data rates (like
302 * with OHCI) data can get lost.
303 */
304 if (tty)
305 tty->low_latency = 1;
306
307 /* Start reading from the device */ 299 /* Start reading from the device */
308 usb_fill_bulk_urb(port->read_urb, serial->dev, 300 usb_fill_bulk_urb(port->read_urb, serial->dev,
309 usb_rcvbulkpipe(serial->dev, 301 usb_rcvbulkpipe(serial->dev,