aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/ark3116.c2
-rw-r--r--drivers/usb/serial/cypress_m8.c18
-rw-r--r--drivers/usb/serial/cypress_m8.h4
-rw-r--r--drivers/usb/serial/f81232.c8
-rw-r--r--drivers/usb/serial/ftdi_sio.c30
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h2
-rw-r--r--drivers/usb/serial/generic.c31
-rw-r--r--drivers/usb/serial/io_ti.c22
-rw-r--r--drivers/usb/serial/iuu_phoenix.c4
-rw-r--r--drivers/usb/serial/keyspan.c10
-rw-r--r--drivers/usb/serial/mos7720.c25
-rw-r--r--drivers/usb/serial/mos7840.c35
-rw-r--r--drivers/usb/serial/option.c39
-rw-r--r--drivers/usb/serial/pl2303.c10
-rw-r--r--drivers/usb/serial/qcserial.c1
-rw-r--r--drivers/usb/serial/spcp8x5.c10
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c26
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.h4
-rw-r--r--drivers/usb/serial/usb-serial.c34
-rw-r--r--drivers/usb/serial/visor.c9
-rw-r--r--drivers/usb/serial/whiteheat.c2
-rw-r--r--drivers/usb/serial/zte_ev.c58
22 files changed, 240 insertions, 144 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 3b16118cbf62..40e7fd94646f 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -43,7 +43,7 @@
43#define DRIVER_NAME "ark3116" 43#define DRIVER_NAME "ark3116"
44 44
45/* usb timeout of 1 second */ 45/* usb timeout of 1 second */
46#define ARK_TIMEOUT (1*HZ) 46#define ARK_TIMEOUT 1000
47 47
48static const struct usb_device_id id_table[] = { 48static const struct usb_device_id id_table[] = {
49 { USB_DEVICE(0x6547, 0x0232) }, 49 { USB_DEVICE(0x6547, 0x0232) },
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index d341555d37d8..082120198f87 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -65,6 +65,7 @@ static const struct usb_device_id id_table_earthmate[] = {
65static const struct usb_device_id id_table_cyphidcomrs232[] = { 65static const struct usb_device_id id_table_cyphidcomrs232[] = {
66 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, 66 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) },
67 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, 67 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) },
68 { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) },
68 { } /* Terminating entry */ 69 { } /* Terminating entry */
69}; 70};
70 71
@@ -78,6 +79,7 @@ static const struct usb_device_id id_table_combined[] = {
78 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, 79 { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) },
79 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, 80 { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) },
80 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, 81 { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) },
82 { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) },
81 { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, 83 { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) },
82 { } /* Terminating entry */ 84 { } /* Terminating entry */
83}; 85};
@@ -229,6 +231,12 @@ static struct usb_serial_driver * const serial_drivers[] = {
229 * Cypress serial helper functions 231 * Cypress serial helper functions
230 *****************************************************************************/ 232 *****************************************************************************/
231 233
234/* FRWD Dongle hidcom needs to skip reset and speed checks */
235static inline bool is_frwd(struct usb_device *dev)
236{
237 return ((le16_to_cpu(dev->descriptor.idVendor) == VENDOR_ID_FRWD) &&
238 (le16_to_cpu(dev->descriptor.idProduct) == PRODUCT_ID_CYPHIDCOM_FRWD));
239}
232 240
233static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) 241static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate)
234{ 242{
@@ -238,6 +246,10 @@ static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate)
238 if (unstable_bauds) 246 if (unstable_bauds)
239 return new_rate; 247 return new_rate;
240 248
249 /* FRWD Dongle uses 115200 bps */
250 if (is_frwd(port->serial->dev))
251 return new_rate;
252
241 /* 253 /*
242 * The general purpose firmware for the Cypress M8 allows for 254 * The general purpose firmware for the Cypress M8 allows for
243 * a maximum speed of 57600bps (I have no idea whether DeLorme 255 * a maximum speed of 57600bps (I have no idea whether DeLorme
@@ -448,7 +460,11 @@ static int cypress_generic_port_probe(struct usb_serial_port *port)
448 return -ENOMEM; 460 return -ENOMEM;
449 } 461 }
450 462
451 usb_reset_configuration(serial->dev); 463 /* Skip reset for FRWD device. It is a workaound:
464 device hangs if it receives SET_CONFIGURE in Configured
465 state. */
466 if (!is_frwd(serial->dev))
467 usb_reset_configuration(serial->dev);
452 468
453 priv->cmd_ctrl = 0; 469 priv->cmd_ctrl = 0;
454 priv->line_control = 0; 470 priv->line_control = 0;
diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h
index 67cf60826884..b461311a2ae7 100644
--- a/drivers/usb/serial/cypress_m8.h
+++ b/drivers/usb/serial/cypress_m8.h
@@ -24,6 +24,10 @@
24#define VENDOR_ID_CYPRESS 0x04b4 24#define VENDOR_ID_CYPRESS 0x04b4
25#define PRODUCT_ID_CYPHIDCOM 0x5500 25#define PRODUCT_ID_CYPHIDCOM 0x5500
26 26
27/* FRWD Dongle - a GPS sports watch */
28#define VENDOR_ID_FRWD 0x6737
29#define PRODUCT_ID_CYPHIDCOM_FRWD 0x0001
30
27/* Powercom UPS, chip CY7C63723 */ 31/* Powercom UPS, chip CY7C63723 */
28#define VENDOR_ID_POWERCOM 0x0d9f 32#define VENDOR_ID_POWERCOM 0x0d9f
29#define PRODUCT_ID_UPS 0x0002 33#define PRODUCT_ID_UPS 0x0002
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
index 090b411d893f..7d8dd5aad236 100644
--- a/drivers/usb/serial/f81232.c
+++ b/drivers/usb/serial/f81232.c
@@ -165,11 +165,12 @@ static void f81232_set_termios(struct tty_struct *tty,
165 /* FIXME - Stubbed out for now */ 165 /* FIXME - Stubbed out for now */
166 166
167 /* Don't change anything if nothing has changed */ 167 /* Don't change anything if nothing has changed */
168 if (!tty_termios_hw_change(&tty->termios, old_termios)) 168 if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
169 return; 169 return;
170 170
171 /* Do the real work here... */ 171 /* Do the real work here... */
172 tty_termios_copy_hw(&tty->termios, old_termios); 172 if (old_termios)
173 tty_termios_copy_hw(&tty->termios, old_termios);
173} 174}
174 175
175static int f81232_tiocmget(struct tty_struct *tty) 176static int f81232_tiocmget(struct tty_struct *tty)
@@ -187,12 +188,11 @@ static int f81232_tiocmset(struct tty_struct *tty,
187 188
188static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port) 189static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
189{ 190{
190 struct ktermios tmp_termios;
191 int result; 191 int result;
192 192
193 /* Setup termios */ 193 /* Setup termios */
194 if (tty) 194 if (tty)
195 f81232_set_termios(tty, port, &tmp_termios); 195 f81232_set_termios(tty, port, NULL);
196 196
197 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 197 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
198 if (result) { 198 if (result) {
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 242b5776648a..7260ec660347 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -189,6 +189,8 @@ static struct usb_device_id id_table_combined [] = {
189 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, 189 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
190 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) }, 190 { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) },
191 { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) }, 191 { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) },
192 { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_CC_PID) },
193 { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_AGP_PID) },
192 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, 194 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
193 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, 195 { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
194 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) }, 196 { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
@@ -924,8 +926,8 @@ static int ftdi_tiocmset(struct tty_struct *tty,
924static int ftdi_ioctl(struct tty_struct *tty, 926static int ftdi_ioctl(struct tty_struct *tty,
925 unsigned int cmd, unsigned long arg); 927 unsigned int cmd, unsigned long arg);
926static void ftdi_break_ctl(struct tty_struct *tty, int break_state); 928static void ftdi_break_ctl(struct tty_struct *tty, int break_state);
927static int ftdi_chars_in_buffer(struct tty_struct *tty); 929static bool ftdi_tx_empty(struct usb_serial_port *port);
928static int ftdi_get_modem_status(struct tty_struct *tty, 930static int ftdi_get_modem_status(struct usb_serial_port *port,
929 unsigned char status[2]); 931 unsigned char status[2]);
930 932
931static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); 933static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base);
@@ -961,7 +963,7 @@ static struct usb_serial_driver ftdi_sio_device = {
961 .ioctl = ftdi_ioctl, 963 .ioctl = ftdi_ioctl,
962 .set_termios = ftdi_set_termios, 964 .set_termios = ftdi_set_termios,
963 .break_ctl = ftdi_break_ctl, 965 .break_ctl = ftdi_break_ctl,
964 .chars_in_buffer = ftdi_chars_in_buffer, 966 .tx_empty = ftdi_tx_empty,
965}; 967};
966 968
967static struct usb_serial_driver * const serial_drivers[] = { 969static struct usb_serial_driver * const serial_drivers[] = {
@@ -2056,27 +2058,18 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
2056 2058
2057} 2059}
2058 2060
2059static int ftdi_chars_in_buffer(struct tty_struct *tty) 2061static bool ftdi_tx_empty(struct usb_serial_port *port)
2060{ 2062{
2061 struct usb_serial_port *port = tty->driver_data;
2062 int chars;
2063 unsigned char buf[2]; 2063 unsigned char buf[2];
2064 int ret; 2064 int ret;
2065 2065
2066 chars = usb_serial_generic_chars_in_buffer(tty); 2066 ret = ftdi_get_modem_status(port, buf);
2067 if (chars)
2068 goto out;
2069
2070 /* Check if hardware buffer is empty. */
2071 ret = ftdi_get_modem_status(tty, buf);
2072 if (ret == 2) { 2067 if (ret == 2) {
2073 if (!(buf[1] & FTDI_RS_TEMT)) 2068 if (!(buf[1] & FTDI_RS_TEMT))
2074 chars = 1; 2069 return false;
2075 } 2070 }
2076out:
2077 dev_dbg(&port->dev, "%s - %d\n", __func__, chars);
2078 2071
2079 return chars; 2072 return true;
2080} 2073}
2081 2074
2082/* old_termios contains the original termios settings and tty->termios contains 2075/* old_termios contains the original termios settings and tty->termios contains
@@ -2268,10 +2261,9 @@ no_c_cflag_changes:
2268 * Returns the number of status bytes retrieved (device dependant), or 2261 * Returns the number of status bytes retrieved (device dependant), or
2269 * negative error code. 2262 * negative error code.
2270 */ 2263 */
2271static int ftdi_get_modem_status(struct tty_struct *tty, 2264static int ftdi_get_modem_status(struct usb_serial_port *port,
2272 unsigned char status[2]) 2265 unsigned char status[2])
2273{ 2266{
2274 struct usb_serial_port *port = tty->driver_data;
2275 struct ftdi_private *priv = usb_get_serial_port_data(port); 2267 struct ftdi_private *priv = usb_get_serial_port_data(port);
2276 unsigned char *buf; 2268 unsigned char *buf;
2277 int len; 2269 int len;
@@ -2336,7 +2328,7 @@ static int ftdi_tiocmget(struct tty_struct *tty)
2336 unsigned char buf[2]; 2328 unsigned char buf[2];
2337 int ret; 2329 int ret;
2338 2330
2339 ret = ftdi_get_modem_status(tty, buf); 2331 ret = ftdi_get_modem_status(port, buf);
2340 if (ret < 0) 2332 if (ret < 0)
2341 return ret; 2333 return ret;
2342 2334
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 98528270c43c..6dd79253205d 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -772,6 +772,8 @@
772 */ 772 */
773#define NEWPORT_VID 0x104D 773#define NEWPORT_VID 0x104D
774#define NEWPORT_AGILIS_PID 0x3000 774#define NEWPORT_AGILIS_PID 0x3000
775#define NEWPORT_CONEX_CC_PID 0x3002
776#define NEWPORT_CONEX_AGP_PID 0x3006
775 777
776/* Interbiometrics USB I/O Board */ 778/* Interbiometrics USB I/O Board */
777/* Developed for Interbiometrics by Rudolf Gugler */ 779/* Developed for Interbiometrics by Rudolf Gugler */
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 297665fdd16d..ba45170c78e5 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -253,6 +253,37 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
253} 253}
254EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer); 254EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer);
255 255
256void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout)
257{
258 struct usb_serial_port *port = tty->driver_data;
259 unsigned int bps;
260 unsigned long period;
261 unsigned long expire;
262
263 bps = tty_get_baud_rate(tty);
264 if (!bps)
265 bps = 9600; /* B0 */
266 /*
267 * Use a poll-period of roughly the time it takes to send one
268 * character or at least one jiffy.
269 */
270 period = max_t(unsigned long, (10 * HZ / bps), 1);
271 period = min_t(unsigned long, period, timeout);
272
273 dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n",
274 __func__, jiffies_to_msecs(timeout),
275 jiffies_to_msecs(period));
276 expire = jiffies + timeout;
277 while (!port->serial->type->tx_empty(port)) {
278 schedule_timeout_interruptible(period);
279 if (signal_pending(current))
280 break;
281 if (time_after(jiffies, expire))
282 break;
283 }
284}
285EXPORT_SYMBOL_GPL(usb_serial_generic_wait_until_sent);
286
256static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, 287static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port,
257 int index, gfp_t mem_flags) 288 int index, gfp_t mem_flags)
258{ 289{
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 158bf4bc29cc..1be6ba7bee27 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2019,8 +2019,6 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
2019 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 2019 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2020 int chars = 0; 2020 int chars = 0;
2021 unsigned long flags; 2021 unsigned long flags;
2022 int ret;
2023
2024 if (edge_port == NULL) 2022 if (edge_port == NULL)
2025 return 0; 2023 return 0;
2026 2024
@@ -2028,16 +2026,22 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
2028 chars = kfifo_len(&edge_port->write_fifo); 2026 chars = kfifo_len(&edge_port->write_fifo);
2029 spin_unlock_irqrestore(&edge_port->ep_lock, flags); 2027 spin_unlock_irqrestore(&edge_port->ep_lock, flags);
2030 2028
2031 if (!chars) {
2032 ret = tx_active(edge_port);
2033 if (ret > 0)
2034 chars = ret;
2035 }
2036
2037 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 2029 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
2038 return chars; 2030 return chars;
2039} 2031}
2040 2032
2033static bool edge_tx_empty(struct usb_serial_port *port)
2034{
2035 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2036 int ret;
2037
2038 ret = tx_active(edge_port);
2039 if (ret > 0)
2040 return false;
2041
2042 return true;
2043}
2044
2041static void edge_throttle(struct tty_struct *tty) 2045static void edge_throttle(struct tty_struct *tty)
2042{ 2046{
2043 struct usb_serial_port *port = tty->driver_data; 2047 struct usb_serial_port *port = tty->driver_data;
@@ -2557,6 +2561,7 @@ static struct usb_serial_driver edgeport_1port_device = {
2557 .write = edge_write, 2561 .write = edge_write,
2558 .write_room = edge_write_room, 2562 .write_room = edge_write_room,
2559 .chars_in_buffer = edge_chars_in_buffer, 2563 .chars_in_buffer = edge_chars_in_buffer,
2564 .tx_empty = edge_tx_empty,
2560 .break_ctl = edge_break, 2565 .break_ctl = edge_break,
2561 .read_int_callback = edge_interrupt_callback, 2566 .read_int_callback = edge_interrupt_callback,
2562 .read_bulk_callback = edge_bulk_in_callback, 2567 .read_bulk_callback = edge_bulk_in_callback,
@@ -2589,6 +2594,7 @@ static struct usb_serial_driver edgeport_2port_device = {
2589 .write = edge_write, 2594 .write = edge_write,
2590 .write_room = edge_write_room, 2595 .write_room = edge_write_room,
2591 .chars_in_buffer = edge_chars_in_buffer, 2596 .chars_in_buffer = edge_chars_in_buffer,
2597 .tx_empty = edge_tx_empty,
2592 .break_ctl = edge_break, 2598 .break_ctl = edge_break,
2593 .read_int_callback = edge_interrupt_callback, 2599 .read_int_callback = edge_interrupt_callback,
2594 .read_bulk_callback = edge_bulk_in_callback, 2600 .read_bulk_callback = edge_bulk_in_callback,
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 9d74c278b7b5..790673e5faa7 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -287,7 +287,7 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
287 usb_bulk_msg(serial->dev, 287 usb_bulk_msg(serial->dev,
288 usb_sndbulkpipe(serial->dev, 288 usb_sndbulkpipe(serial->dev,
289 port->bulk_out_endpointAddress), buf, 289 port->bulk_out_endpointAddress), buf,
290 count, &actual, HZ * 1); 290 count, &actual, 1000);
291 291
292 if (status != IUU_OPERATION_OK) 292 if (status != IUU_OPERATION_OK)
293 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); 293 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status);
@@ -307,7 +307,7 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
307 usb_bulk_msg(serial->dev, 307 usb_bulk_msg(serial->dev,
308 usb_rcvbulkpipe(serial->dev, 308 usb_rcvbulkpipe(serial->dev,
309 port->bulk_in_endpointAddress), buf, 309 port->bulk_in_endpointAddress), buf,
310 count, &actual, HZ * 1); 310 count, &actual, 1000);
311 311
312 if (status != IUU_OPERATION_OK) 312 if (status != IUU_OPERATION_OK)
313 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); 313 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status);
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index eb30d7b01f36..3549d073df22 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1548,7 +1548,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1548 struct keyspan_serial_private *s_priv; 1548 struct keyspan_serial_private *s_priv;
1549 struct keyspan_port_private *p_priv; 1549 struct keyspan_port_private *p_priv;
1550 const struct keyspan_device_details *d_details; 1550 const struct keyspan_device_details *d_details;
1551 int outcont_urb;
1552 struct urb *this_urb; 1551 struct urb *this_urb;
1553 int device_port, err; 1552 int device_port, err;
1554 1553
@@ -1559,7 +1558,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1559 d_details = s_priv->device_details; 1558 d_details = s_priv->device_details;
1560 device_port = port->number - port->serial->minor; 1559 device_port = port->number - port->serial->minor;
1561 1560
1562 outcont_urb = d_details->outcont_endpoints[port->number];
1563 this_urb = p_priv->outcont_urb; 1561 this_urb = p_priv->outcont_urb;
1564 1562
1565 dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe)); 1563 dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe));
@@ -1685,14 +1683,6 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1685 err = usb_submit_urb(this_urb, GFP_ATOMIC); 1683 err = usb_submit_urb(this_urb, GFP_ATOMIC);
1686 if (err != 0) 1684 if (err != 0)
1687 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err); 1685 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
1688#if 0
1689 else {
1690 dev_dbg(&port->dev, "%s - usb_submit_urb(%d) OK %d bytes (end %d)\n", __func__
1691 outcont_urb, this_urb->transfer_buffer_length,
1692 usb_pipeendpoint(this_urb->pipe));
1693 }
1694#endif
1695
1696 return 0; 1686 return 0;
1697} 1687}
1698 1688
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index cc0e54345df9..f27c621a9297 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -40,7 +40,7 @@
40#define DRIVER_DESC "Moschip USB Serial Driver" 40#define DRIVER_DESC "Moschip USB Serial Driver"
41 41
42/* default urb timeout */ 42/* default urb timeout */
43#define MOS_WDR_TIMEOUT (HZ * 5) 43#define MOS_WDR_TIMEOUT 5000
44 44
45#define MOS_MAX_PORT 0x02 45#define MOS_MAX_PORT 0x02
46#define MOS_WRITE 0x0E 46#define MOS_WRITE 0x0E
@@ -227,11 +227,22 @@ static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum,
227 __u8 requesttype = (__u8)0xc0; 227 __u8 requesttype = (__u8)0xc0;
228 __u16 index = get_reg_index(reg); 228 __u16 index = get_reg_index(reg);
229 __u16 value = get_reg_value(reg, serial_portnum); 229 __u16 value = get_reg_value(reg, serial_portnum);
230 int status = usb_control_msg(usbdev, pipe, request, requesttype, value, 230 u8 *buf;
231 index, data, 1, MOS_WDR_TIMEOUT); 231 int status;
232 if (status < 0) 232
233 buf = kmalloc(1, GFP_KERNEL);
234 if (!buf)
235 return -ENOMEM;
236
237 status = usb_control_msg(usbdev, pipe, request, requesttype, value,
238 index, buf, 1, MOS_WDR_TIMEOUT);
239 if (status == 1)
240 *data = *buf;
241 else if (status < 0)
233 dev_err(&usbdev->dev, 242 dev_err(&usbdev->dev,
234 "mos7720: usb_control_msg() failed: %d", status); 243 "mos7720: usb_control_msg() failed: %d", status);
244 kfree(buf);
245
235 return status; 246 return status;
236} 247}
237 248
@@ -1618,7 +1629,7 @@ static void change_port_settings(struct tty_struct *tty,
1618 mos7720_port->shadowMCR |= (UART_MCR_XONANY); 1629 mos7720_port->shadowMCR |= (UART_MCR_XONANY);
1619 /* To set hardware flow control to the specified * 1630 /* To set hardware flow control to the specified *
1620 * serial port, in SP1/2_CONTROL_REG */ 1631 * serial port, in SP1/2_CONTROL_REG */
1621 if (port->number) 1632 if (port_number)
1622 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01); 1633 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01);
1623 else 1634 else
1624 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02); 1635 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02);
@@ -1927,7 +1938,7 @@ static int mos7720_startup(struct usb_serial *serial)
1927 1938
1928 /* setting configuration feature to one */ 1939 /* setting configuration feature to one */
1929 usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 1940 usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
1930 (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); 1941 (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000);
1931 1942
1932 /* start the interrupt urb */ 1943 /* start the interrupt urb */
1933 ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); 1944 ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL);
@@ -1970,7 +1981,7 @@ static void mos7720_release(struct usb_serial *serial)
1970 /* wait for synchronous usb calls to return */ 1981 /* wait for synchronous usb calls to return */
1971 if (mos_parport->msg_pending) 1982 if (mos_parport->msg_pending)
1972 wait_for_completion_timeout(&mos_parport->syncmsg_compl, 1983 wait_for_completion_timeout(&mos_parport->syncmsg_compl,
1973 MOS_WDR_TIMEOUT); 1984 msecs_to_jiffies(MOS_WDR_TIMEOUT));
1974 1985
1975 parport_remove_port(mos_parport->pp); 1986 parport_remove_port(mos_parport->pp);
1976 usb_set_serial_data(serial, NULL); 1987 usb_set_serial_data(serial, NULL);
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index a0d5ea545982..7e998081e1cd 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2142,13 +2142,21 @@ static int mos7840_ioctl(struct tty_struct *tty,
2142static int mos7810_check(struct usb_serial *serial) 2142static int mos7810_check(struct usb_serial *serial)
2143{ 2143{
2144 int i, pass_count = 0; 2144 int i, pass_count = 0;
2145 u8 *buf;
2145 __u16 data = 0, mcr_data = 0; 2146 __u16 data = 0, mcr_data = 0;
2146 __u16 test_pattern = 0x55AA; 2147 __u16 test_pattern = 0x55AA;
2148 int res;
2149
2150 buf = kmalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
2151 if (!buf)
2152 return 0; /* failed to identify 7810 */
2147 2153
2148 /* Store MCR setting */ 2154 /* Store MCR setting */
2149 usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 2155 res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
2150 MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER, 2156 MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER,
2151 &mcr_data, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); 2157 buf, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
2158 if (res == VENDOR_READ_LENGTH)
2159 mcr_data = *buf;
2152 2160
2153 for (i = 0; i < 16; i++) { 2161 for (i = 0; i < 16; i++) {
2154 /* Send the 1-bit test pattern out to MCS7810 test pin */ 2162 /* Send the 1-bit test pattern out to MCS7810 test pin */
@@ -2158,9 +2166,12 @@ static int mos7810_check(struct usb_serial *serial)
2158 MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); 2166 MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT);
2159 2167
2160 /* Read the test pattern back */ 2168 /* Read the test pattern back */
2161 usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 2169 res = usb_control_msg(serial->dev,
2162 MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, 2170 usb_rcvctrlpipe(serial->dev, 0), MCS_RDREQ,
2163 VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); 2171 MCS_RD_RTYPE, 0, GPIO_REGISTER, buf,
2172 VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
2173 if (res == VENDOR_READ_LENGTH)
2174 data = *buf;
2164 2175
2165 /* If this is a MCS7810 device, both test patterns must match */ 2176 /* If this is a MCS7810 device, both test patterns must match */
2166 if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001) 2177 if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001)
@@ -2174,6 +2185,8 @@ static int mos7810_check(struct usb_serial *serial)
2174 MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL, 2185 MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL,
2175 0, MOS_WDR_TIMEOUT); 2186 0, MOS_WDR_TIMEOUT);
2176 2187
2188 kfree(buf);
2189
2177 if (pass_count == 16) 2190 if (pass_count == 16)
2178 return 1; 2191 return 1;
2179 2192
@@ -2183,11 +2196,17 @@ static int mos7810_check(struct usb_serial *serial)
2183static int mos7840_calc_num_ports(struct usb_serial *serial) 2196static int mos7840_calc_num_ports(struct usb_serial *serial)
2184{ 2197{
2185 __u16 data = 0x00; 2198 __u16 data = 0x00;
2199 u8 *buf;
2186 int mos7840_num_ports; 2200 int mos7840_num_ports;
2187 2201
2188 usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 2202 buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL);
2189 MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, 2203 if (buf) {
2190 VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); 2204 usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
2205 MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf,
2206 VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT);
2207 data = *buf;
2208 kfree(buf);
2209 }
2191 2210
2192 if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || 2211 if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 ||
2193 serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { 2212 serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) {
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 734372846abb..bd4323ddae1a 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -196,6 +196,7 @@ static void option_instat_callback(struct urb *urb);
196 196
197#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */ 197#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */
198#define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */ 198#define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */
199#define DELL_PRODUCT_5804_MINICARD_ATT 0x819b /* Novatel E371 */
199 200
200#define KYOCERA_VENDOR_ID 0x0c88 201#define KYOCERA_VENDOR_ID 0x0c88
201#define KYOCERA_PRODUCT_KPC650 0x17da 202#define KYOCERA_PRODUCT_KPC650 0x17da
@@ -249,13 +250,7 @@ static void option_instat_callback(struct urb *urb);
249#define ZTE_PRODUCT_MF622 0x0001 250#define ZTE_PRODUCT_MF622 0x0001
250#define ZTE_PRODUCT_MF628 0x0015 251#define ZTE_PRODUCT_MF628 0x0015
251#define ZTE_PRODUCT_MF626 0x0031 252#define ZTE_PRODUCT_MF626 0x0031
252#define ZTE_PRODUCT_CDMA_TECH 0xfffe
253#define ZTE_PRODUCT_AC8710 0xfff1
254#define ZTE_PRODUCT_AC2726 0xfff5
255#define ZTE_PRODUCT_AC8710T 0xffff
256#define ZTE_PRODUCT_MC2718 0xffe8 253#define ZTE_PRODUCT_MC2718 0xffe8
257#define ZTE_PRODUCT_AD3812 0xffeb
258#define ZTE_PRODUCT_MC2716 0xffed
259 254
260#define BENQ_VENDOR_ID 0x04a5 255#define BENQ_VENDOR_ID 0x04a5
261#define BENQ_PRODUCT_H10 0x4068 256#define BENQ_PRODUCT_H10 0x4068
@@ -341,8 +336,8 @@ static void option_instat_callback(struct urb *urb);
341#define CINTERION_PRODUCT_EU3_E 0x0051 336#define CINTERION_PRODUCT_EU3_E 0x0051
342#define CINTERION_PRODUCT_EU3_P 0x0052 337#define CINTERION_PRODUCT_EU3_P 0x0052
343#define CINTERION_PRODUCT_PH8 0x0053 338#define CINTERION_PRODUCT_PH8 0x0053
344#define CINTERION_PRODUCT_AH6 0x0055 339#define CINTERION_PRODUCT_AHXX 0x0055
345#define CINTERION_PRODUCT_PLS8 0x0060 340#define CINTERION_PRODUCT_PLXX 0x0060
346 341
347/* Olivetti products */ 342/* Olivetti products */
348#define OLIVETTI_VENDOR_ID 0x0b3c 343#define OLIVETTI_VENDOR_ID 0x0b3c
@@ -494,18 +489,10 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = {
494 .reserved = BIT(4), 489 .reserved = BIT(4),
495}; 490};
496 491
497static const struct option_blacklist_info zte_ad3812_z_blacklist = {
498 .sendsetup = BIT(0) | BIT(1) | BIT(2),
499};
500
501static const struct option_blacklist_info zte_mc2718_z_blacklist = { 492static const struct option_blacklist_info zte_mc2718_z_blacklist = {
502 .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), 493 .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4),
503}; 494};
504 495
505static const struct option_blacklist_info zte_mc2716_z_blacklist = {
506 .sendsetup = BIT(1) | BIT(2) | BIT(3),
507};
508
509static const struct option_blacklist_info huawei_cdc12_blacklist = { 496static const struct option_blacklist_info huawei_cdc12_blacklist = {
510 .reserved = BIT(1) | BIT(2), 497 .reserved = BIT(1) | BIT(2),
511}; 498};
@@ -592,6 +579,8 @@ static const struct usb_device_id option_ids[] = {
592 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 579 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
593 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), 580 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
594 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 581 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
582 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x14ac, 0xff, 0xff, 0xff), /* Huawei E1820 */
583 .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
595 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), 584 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff),
596 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 585 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
597 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) }, 586 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) },
@@ -771,6 +760,7 @@ static const struct usb_device_id option_ids[] = {
771 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ 760 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
772 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) }, 761 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) },
773 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) }, 762 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) },
763 { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5804_MINICARD_ATT, 0xff, 0xff, 0xff) },
774 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ 764 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
775 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 765 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
776 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, 766 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
@@ -795,7 +785,6 @@ static const struct usb_device_id option_ids[] = {
795 { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) }, 785 { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) },
796 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, 786 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) },
797 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, 787 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
798 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */
799 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ 788 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
800 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ 789 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
801 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ 790 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */
@@ -966,6 +955,8 @@ static const struct usb_device_id option_ids[] = {
966 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 955 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
967 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) }, 956 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) },
968 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) }, 957 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) },
958 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0412, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G */
959 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
969 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) }, 960 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) },
970 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) }, 961 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) },
971 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), 962 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
@@ -1195,16 +1186,9 @@ static const struct usb_device_id option_ids[] = {
1195 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff), 1186 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff),
1196 .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, 1187 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1197 1188
1198 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, 1189 /* NOTE: most ZTE CDMA devices should be driven by zte_ev, not option */
1199 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
1200 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
1201 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) },
1202 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), 1190 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff),
1203 .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, 1191 .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist },
1204 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff),
1205 .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist },
1206 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff),
1207 .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist },
1208 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, 1192 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) },
1209 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, 1193 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) },
1210 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, 1194 { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) },
@@ -1264,8 +1248,9 @@ static const struct usb_device_id option_ids[] = {
1264 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, 1248 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
1265 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, 1249 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
1266 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, 1250 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
1267 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) }, 1251 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) },
1268 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) }, 1252 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
1253 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1269 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, 1254 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
1270 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, 1255 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
1271 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, 1256 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 7151659367a0..048cd44d51b1 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -284,7 +284,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
284 serial settings even to the same values as before. Thus 284 serial settings even to the same values as before. Thus
285 we actually need to filter in this specific case */ 285 we actually need to filter in this specific case */
286 286
287 if (!tty_termios_hw_change(&tty->termios, old_termios)) 287 if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
288 return; 288 return;
289 289
290 cflag = tty->termios.c_cflag; 290 cflag = tty->termios.c_cflag;
@@ -293,7 +293,8 @@ static void pl2303_set_termios(struct tty_struct *tty,
293 if (!buf) { 293 if (!buf) {
294 dev_err(&port->dev, "%s - out of memory.\n", __func__); 294 dev_err(&port->dev, "%s - out of memory.\n", __func__);
295 /* Report back no change occurred */ 295 /* Report back no change occurred */
296 tty->termios = *old_termios; 296 if (old_termios)
297 tty->termios = *old_termios;
297 return; 298 return;
298 } 299 }
299 300
@@ -433,7 +434,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
433 control = priv->line_control; 434 control = priv->line_control;
434 if ((cflag & CBAUD) == B0) 435 if ((cflag & CBAUD) == B0)
435 priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); 436 priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
436 else if ((old_termios->c_cflag & CBAUD) == B0) 437 else if (old_termios && (old_termios->c_cflag & CBAUD) == B0)
437 priv->line_control |= (CONTROL_DTR | CONTROL_RTS); 438 priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
438 if (control != priv->line_control) { 439 if (control != priv->line_control) {
439 control = priv->line_control; 440 control = priv->line_control;
@@ -492,7 +493,6 @@ static void pl2303_close(struct usb_serial_port *port)
492 493
493static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) 494static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
494{ 495{
495 struct ktermios tmp_termios;
496 struct usb_serial *serial = port->serial; 496 struct usb_serial *serial = port->serial;
497 struct pl2303_serial_private *spriv = usb_get_serial_data(serial); 497 struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
498 int result; 498 int result;
@@ -508,7 +508,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
508 508
509 /* Setup termios */ 509 /* Setup termios */
510 if (tty) 510 if (tty)
511 pl2303_set_termios(tty, port, &tmp_termios); 511 pl2303_set_termios(tty, port, NULL);
512 512
513 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 513 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
514 if (result) { 514 if (result) {
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 59b32b782126..bd794b43898c 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -118,6 +118,7 @@ static const struct usb_device_id id_table[] = {
118 {USB_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ 118 {USB_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */
119 {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */ 119 {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */
120 {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */ 120 {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */
121 {USB_DEVICE(0x0AF0, 0x8120)}, /* Option GTM681W */
121 122
122 /* non Gobi Qualcomm serial devices */ 123 /* non Gobi Qualcomm serial devices */
123 {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 0)}, /* Sierra Wireless MC7700 Device Management */ 124 {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 0)}, /* Sierra Wireless MC7700 Device Management */
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index cf3df793c2b7..ddf6c47137dc 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -291,7 +291,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
291 struct spcp8x5_private *priv = usb_get_serial_port_data(port); 291 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
292 unsigned long flags; 292 unsigned long flags;
293 unsigned int cflag = tty->termios.c_cflag; 293 unsigned int cflag = tty->termios.c_cflag;
294 unsigned int old_cflag = old_termios->c_cflag;
295 unsigned short uartdata; 294 unsigned short uartdata;
296 unsigned char buf[2] = {0, 0}; 295 unsigned char buf[2] = {0, 0};
297 int baud; 296 int baud;
@@ -299,15 +298,15 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
299 u8 control; 298 u8 control;
300 299
301 /* check that they really want us to change something */ 300 /* check that they really want us to change something */
302 if (!tty_termios_hw_change(&tty->termios, old_termios)) 301 if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios))
303 return; 302 return;
304 303
305 /* set DTR/RTS active */ 304 /* set DTR/RTS active */
306 spin_lock_irqsave(&priv->lock, flags); 305 spin_lock_irqsave(&priv->lock, flags);
307 control = priv->line_control; 306 control = priv->line_control;
308 if ((old_cflag & CBAUD) == B0) { 307 if (old_termios && (old_termios->c_cflag & CBAUD) == B0) {
309 priv->line_control |= MCR_DTR; 308 priv->line_control |= MCR_DTR;
310 if (!(old_cflag & CRTSCTS)) 309 if (!(old_termios->c_cflag & CRTSCTS))
311 priv->line_control |= MCR_RTS; 310 priv->line_control |= MCR_RTS;
312 } 311 }
313 if (control != priv->line_control) { 312 if (control != priv->line_control) {
@@ -394,7 +393,6 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
394 393
395static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port) 394static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port)
396{ 395{
397 struct ktermios tmp_termios;
398 struct usb_serial *serial = port->serial; 396 struct usb_serial *serial = port->serial;
399 struct spcp8x5_private *priv = usb_get_serial_port_data(port); 397 struct spcp8x5_private *priv = usb_get_serial_port_data(port);
400 int ret; 398 int ret;
@@ -411,7 +409,7 @@ static int spcp8x5_open(struct tty_struct *tty, struct usb_serial_port *port)
411 spcp8x5_set_ctrl_line(port, priv->line_control); 409 spcp8x5_set_ctrl_line(port, priv->line_control);
412 410
413 if (tty) 411 if (tty)
414 spcp8x5_set_termios(tty, port, &tmp_termios); 412 spcp8x5_set_termios(tty, port, NULL);
415 413
416 port->port.drain_delay = 256; 414 port->port.drain_delay = 256;
417 415
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index cac47aef2918..e581c2549a57 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -101,6 +101,7 @@ static int ti_write(struct tty_struct *tty, struct usb_serial_port *port,
101 const unsigned char *data, int count); 101 const unsigned char *data, int count);
102static int ti_write_room(struct tty_struct *tty); 102static int ti_write_room(struct tty_struct *tty);
103static int ti_chars_in_buffer(struct tty_struct *tty); 103static int ti_chars_in_buffer(struct tty_struct *tty);
104static bool ti_tx_empty(struct usb_serial_port *port);
104static void ti_throttle(struct tty_struct *tty); 105static void ti_throttle(struct tty_struct *tty);
105static void ti_unthrottle(struct tty_struct *tty); 106static void ti_unthrottle(struct tty_struct *tty);
106static int ti_ioctl(struct tty_struct *tty, 107static int ti_ioctl(struct tty_struct *tty,
@@ -171,7 +172,8 @@ static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = {
171 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, 172 { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
172 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, 173 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
173 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, 174 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
174 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, 175 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) },
176 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
175 { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, 177 { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
176}; 178};
177 179
@@ -222,6 +224,7 @@ static struct usb_serial_driver ti_1port_device = {
222 .write = ti_write, 224 .write = ti_write,
223 .write_room = ti_write_room, 225 .write_room = ti_write_room,
224 .chars_in_buffer = ti_chars_in_buffer, 226 .chars_in_buffer = ti_chars_in_buffer,
227 .tx_empty = ti_tx_empty,
225 .throttle = ti_throttle, 228 .throttle = ti_throttle,
226 .unthrottle = ti_unthrottle, 229 .unthrottle = ti_unthrottle,
227 .ioctl = ti_ioctl, 230 .ioctl = ti_ioctl,
@@ -253,6 +256,7 @@ static struct usb_serial_driver ti_2port_device = {
253 .write = ti_write, 256 .write = ti_write,
254 .write_room = ti_write_room, 257 .write_room = ti_write_room,
255 .chars_in_buffer = ti_chars_in_buffer, 258 .chars_in_buffer = ti_chars_in_buffer,
259 .tx_empty = ti_tx_empty,
256 .throttle = ti_throttle, 260 .throttle = ti_throttle,
257 .unthrottle = ti_unthrottle, 261 .unthrottle = ti_unthrottle,
258 .ioctl = ti_ioctl, 262 .ioctl = ti_ioctl,
@@ -684,8 +688,6 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
684 struct ti_port *tport = usb_get_serial_port_data(port); 688 struct ti_port *tport = usb_get_serial_port_data(port);
685 int chars = 0; 689 int chars = 0;
686 unsigned long flags; 690 unsigned long flags;
687 int ret;
688 u8 lsr;
689 691
690 if (tport == NULL) 692 if (tport == NULL)
691 return 0; 693 return 0;
@@ -694,16 +696,22 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
694 chars = kfifo_len(&tport->write_fifo); 696 chars = kfifo_len(&tport->write_fifo);
695 spin_unlock_irqrestore(&tport->tp_lock, flags); 697 spin_unlock_irqrestore(&tport->tp_lock, flags);
696 698
697 if (!chars) {
698 ret = ti_get_lsr(tport, &lsr);
699 if (!ret && !(lsr & TI_LSR_TX_EMPTY))
700 chars = 1;
701 }
702
703 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 699 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
704 return chars; 700 return chars;
705} 701}
706 702
703static bool ti_tx_empty(struct usb_serial_port *port)
704{
705 struct ti_port *tport = usb_get_serial_port_data(port);
706 int ret;
707 u8 lsr;
708
709 ret = ti_get_lsr(tport, &lsr);
710 if (!ret && !(lsr & TI_LSR_TX_EMPTY))
711 return false;
712
713 return true;
714}
707 715
708static void ti_throttle(struct tty_struct *tty) 716static void ti_throttle(struct tty_struct *tty)
709{ 717{
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
index b353e7e3d480..4a2423e84d55 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -52,7 +52,9 @@
52 52
53/* Abbott Diabetics vendor and product ids */ 53/* Abbott Diabetics vendor and product ids */
54#define ABBOTT_VENDOR_ID 0x1a61 54#define ABBOTT_VENDOR_ID 0x1a61
55#define ABBOTT_PRODUCT_ID 0x3410 55#define ABBOTT_STEREO_PLUG_ID 0x3410
56#define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID
57#define ABBOTT_STRIP_PORT_ID 0x3420
56 58
57/* Commands */ 59/* Commands */
58#define TI_GET_VERSION 0x01 60#define TI_GET_VERSION 0x01
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index cf75beb1251b..5f6b1ff9d29e 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -359,20 +359,29 @@ static int serial_chars_in_buffer(struct tty_struct *tty)
359{ 359{
360 struct usb_serial_port *port = tty->driver_data; 360 struct usb_serial_port *port = tty->driver_data;
361 struct usb_serial *serial = port->serial; 361 struct usb_serial *serial = port->serial;
362 int count = 0;
363 362
364 dev_dbg(tty->dev, "%s\n", __func__); 363 dev_dbg(tty->dev, "%s\n", __func__);
365 364
366 mutex_lock(&serial->disc_mutex);
367 /* if the device was unplugged then any remaining characters
368 fell out of the connector ;) */
369 if (serial->disconnected) 365 if (serial->disconnected)
370 count = 0; 366 return 0;
371 else
372 count = serial->type->chars_in_buffer(tty);
373 mutex_unlock(&serial->disc_mutex);
374 367
375 return count; 368 return serial->type->chars_in_buffer(tty);
369}
370
371static void serial_wait_until_sent(struct tty_struct *tty, int timeout)
372{
373 struct usb_serial_port *port = tty->driver_data;
374 struct usb_serial *serial = port->serial;
375
376 dev_dbg(tty->dev, "%s\n", __func__);
377
378 if (!port->serial->type->wait_until_sent)
379 return;
380
381 mutex_lock(&serial->disc_mutex);
382 if (!serial->disconnected)
383 port->serial->type->wait_until_sent(tty, timeout);
384 mutex_unlock(&serial->disc_mutex);
376} 385}
377 386
378static void serial_throttle(struct tty_struct *tty) 387static void serial_throttle(struct tty_struct *tty)
@@ -399,7 +408,7 @@ static int serial_ioctl(struct tty_struct *tty,
399 unsigned int cmd, unsigned long arg) 408 unsigned int cmd, unsigned long arg)
400{ 409{
401 struct usb_serial_port *port = tty->driver_data; 410 struct usb_serial_port *port = tty->driver_data;
402 int retval = -ENODEV; 411 int retval = -ENOIOCTLCMD;
403 412
404 dev_dbg(tty->dev, "%s - cmd 0x%.4x\n", __func__, cmd); 413 dev_dbg(tty->dev, "%s - cmd 0x%.4x\n", __func__, cmd);
405 414
@@ -411,8 +420,6 @@ static int serial_ioctl(struct tty_struct *tty,
411 default: 420 default:
412 if (port->serial->type->ioctl) 421 if (port->serial->type->ioctl)
413 retval = port->serial->type->ioctl(tty, cmd, arg); 422 retval = port->serial->type->ioctl(tty, cmd, arg);
414 else
415 retval = -ENOIOCTLCMD;
416 } 423 }
417 424
418 return retval; 425 return retval;
@@ -1191,6 +1198,7 @@ static const struct tty_operations serial_ops = {
1191 .unthrottle = serial_unthrottle, 1198 .unthrottle = serial_unthrottle,
1192 .break_ctl = serial_break, 1199 .break_ctl = serial_break,
1193 .chars_in_buffer = serial_chars_in_buffer, 1200 .chars_in_buffer = serial_chars_in_buffer,
1201 .wait_until_sent = serial_wait_until_sent,
1194 .tiocmget = serial_tiocmget, 1202 .tiocmget = serial_tiocmget,
1195 .tiocmset = serial_tiocmset, 1203 .tiocmset = serial_tiocmset,
1196 .get_icount = serial_get_icount, 1204 .get_icount = serial_get_icount,
@@ -1316,6 +1324,8 @@ static void usb_serial_operations_init(struct usb_serial_driver *device)
1316 set_to_generic_if_null(device, close); 1324 set_to_generic_if_null(device, close);
1317 set_to_generic_if_null(device, write_room); 1325 set_to_generic_if_null(device, write_room);
1318 set_to_generic_if_null(device, chars_in_buffer); 1326 set_to_generic_if_null(device, chars_in_buffer);
1327 if (device->tx_empty)
1328 set_to_generic_if_null(device, wait_until_sent);
1319 set_to_generic_if_null(device, read_bulk_callback); 1329 set_to_generic_if_null(device, read_bulk_callback);
1320 set_to_generic_if_null(device, write_bulk_callback); 1330 set_to_generic_if_null(device, write_bulk_callback);
1321 set_to_generic_if_null(device, process_read_urb); 1331 set_to_generic_if_null(device, process_read_urb);
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 7573ec8a084f..9910aa2edf4b 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -560,10 +560,19 @@ static int treo_attach(struct usb_serial *serial)
560 */ 560 */
561#define COPY_PORT(dest, src) \ 561#define COPY_PORT(dest, src) \
562 do { \ 562 do { \
563 int i; \
564 \
565 for (i = 0; i < ARRAY_SIZE(src->read_urbs); ++i) { \
566 dest->read_urbs[i] = src->read_urbs[i]; \
567 dest->read_urbs[i]->context = dest; \
568 dest->bulk_in_buffers[i] = src->bulk_in_buffers[i]; \
569 } \
563 dest->read_urb = src->read_urb; \ 570 dest->read_urb = src->read_urb; \
564 dest->bulk_in_endpointAddress = src->bulk_in_endpointAddress;\ 571 dest->bulk_in_endpointAddress = src->bulk_in_endpointAddress;\
565 dest->bulk_in_buffer = src->bulk_in_buffer; \ 572 dest->bulk_in_buffer = src->bulk_in_buffer; \
573 dest->bulk_in_size = src->bulk_in_size; \
566 dest->interrupt_in_urb = src->interrupt_in_urb; \ 574 dest->interrupt_in_urb = src->interrupt_in_urb; \
575 dest->interrupt_in_urb->context = dest; \
567 dest->interrupt_in_endpointAddress = \ 576 dest->interrupt_in_endpointAddress = \
568 src->interrupt_in_endpointAddress;\ 577 src->interrupt_in_endpointAddress;\
569 dest->interrupt_in_buffer = src->interrupt_in_buffer; \ 578 dest->interrupt_in_buffer = src->interrupt_in_buffer; \
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index b9fca3586d74..347caad47a12 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -649,7 +649,7 @@ static void firm_setup_port(struct tty_struct *tty)
649 struct whiteheat_port_settings port_settings; 649 struct whiteheat_port_settings port_settings;
650 unsigned int cflag = tty->termios.c_cflag; 650 unsigned int cflag = tty->termios.c_cflag;
651 651
652 port_settings.port = port->number + 1; 652 port_settings.port = port->number - port->serial->minor + 1;
653 653
654 /* get the byte size */ 654 /* get the byte size */
655 switch (cflag & CSIZE) { 655 switch (cflag & CSIZE) {
diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c
index 39ee7373b4ee..fca4c752a4ed 100644
--- a/drivers/usb/serial/zte_ev.c
+++ b/drivers/usb/serial/zte_ev.c
@@ -41,9 +41,6 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
41 int len; 41 int len;
42 unsigned char *buf; 42 unsigned char *buf;
43 43
44 if (port->number != 0)
45 return -ENODEV;
46
47 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); 44 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL);
48 if (!buf) 45 if (!buf)
49 return -ENOMEM; 46 return -ENOMEM;
@@ -53,7 +50,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
53 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 50 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
54 0x22, 0x21, 51 0x22, 0x21,
55 0x0001, 0x0000, NULL, len, 52 0x0001, 0x0000, NULL, len,
56 HZ * USB_CTRL_GET_TIMEOUT); 53 USB_CTRL_GET_TIMEOUT);
57 dev_dbg(dev, "result = %d\n", result); 54 dev_dbg(dev, "result = %d\n", result);
58 55
59 /* send 2st cmd and recieve data */ 56 /* send 2st cmd and recieve data */
@@ -65,7 +62,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
65 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 62 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
66 0x21, 0xa1, 63 0x21, 0xa1,
67 0x0000, 0x0000, buf, len, 64 0x0000, 0x0000, buf, len,
68 HZ * USB_CTRL_GET_TIMEOUT); 65 USB_CTRL_GET_TIMEOUT);
69 debug_data(dev, __func__, len, buf, result); 66 debug_data(dev, __func__, len, buf, result);
70 67
71 /* send 3 cmd */ 68 /* send 3 cmd */
@@ -84,7 +81,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
84 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 81 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
85 0x20, 0x21, 82 0x20, 0x21,
86 0x0000, 0x0000, buf, len, 83 0x0000, 0x0000, buf, len,
87 HZ * USB_CTRL_GET_TIMEOUT); 84 USB_CTRL_GET_TIMEOUT);
88 debug_data(dev, __func__, len, buf, result); 85 debug_data(dev, __func__, len, buf, result);
89 86
90 /* send 4 cmd */ 87 /* send 4 cmd */
@@ -95,7 +92,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
95 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 92 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
96 0x22, 0x21, 93 0x22, 0x21,
97 0x0003, 0x0000, NULL, len, 94 0x0003, 0x0000, NULL, len,
98 HZ * USB_CTRL_GET_TIMEOUT); 95 USB_CTRL_GET_TIMEOUT);
99 dev_dbg(dev, "result = %d\n", result); 96 dev_dbg(dev, "result = %d\n", result);
100 97
101 /* send 5 cmd */ 98 /* send 5 cmd */
@@ -107,7 +104,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
107 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 104 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
108 0x21, 0xa1, 105 0x21, 0xa1,
109 0x0000, 0x0000, buf, len, 106 0x0000, 0x0000, buf, len,
110 HZ * USB_CTRL_GET_TIMEOUT); 107 USB_CTRL_GET_TIMEOUT);
111 debug_data(dev, __func__, len, buf, result); 108 debug_data(dev, __func__, len, buf, result);
112 109
113 /* send 6 cmd */ 110 /* send 6 cmd */
@@ -126,7 +123,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty,
126 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 123 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
127 0x20, 0x21, 124 0x20, 0x21,
128 0x0000, 0x0000, buf, len, 125 0x0000, 0x0000, buf, len,
129 HZ * USB_CTRL_GET_TIMEOUT); 126 USB_CTRL_GET_TIMEOUT);
130 debug_data(dev, __func__, len, buf, result); 127 debug_data(dev, __func__, len, buf, result);
131 kfree(buf); 128 kfree(buf);
132 129
@@ -166,9 +163,6 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
166 int len; 163 int len;
167 unsigned char *buf; 164 unsigned char *buf;
168 165
169 if (port->number != 0)
170 return;
171
172 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); 166 buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL);
173 if (!buf) 167 if (!buf)
174 return; 168 return;
@@ -178,7 +172,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
178 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 172 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
179 0x22, 0x21, 173 0x22, 0x21,
180 0x0002, 0x0000, NULL, len, 174 0x0002, 0x0000, NULL, len,
181 HZ * USB_CTRL_GET_TIMEOUT); 175 USB_CTRL_GET_TIMEOUT);
182 dev_dbg(dev, "result = %d\n", result); 176 dev_dbg(dev, "result = %d\n", result);
183 177
184 /* send 2st ctl cmd(CTL 21 22 03 00 00 00 00 00 ) */ 178 /* send 2st ctl cmd(CTL 21 22 03 00 00 00 00 00 ) */
@@ -186,7 +180,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
186 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 180 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
187 0x22, 0x21, 181 0x22, 0x21,
188 0x0003, 0x0000, NULL, len, 182 0x0003, 0x0000, NULL, len,
189 HZ * USB_CTRL_GET_TIMEOUT); 183 USB_CTRL_GET_TIMEOUT);
190 dev_dbg(dev, "result = %d\n", result); 184 dev_dbg(dev, "result = %d\n", result);
191 185
192 /* send 3st cmd and recieve data */ 186 /* send 3st cmd and recieve data */
@@ -198,7 +192,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
198 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 192 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
199 0x21, 0xa1, 193 0x21, 0xa1,
200 0x0000, 0x0000, buf, len, 194 0x0000, 0x0000, buf, len,
201 HZ * USB_CTRL_GET_TIMEOUT); 195 USB_CTRL_GET_TIMEOUT);
202 debug_data(dev, __func__, len, buf, result); 196 debug_data(dev, __func__, len, buf, result);
203 197
204 /* send 4 cmd */ 198 /* send 4 cmd */
@@ -217,7 +211,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
217 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 211 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
218 0x20, 0x21, 212 0x20, 0x21,
219 0x0000, 0x0000, buf, len, 213 0x0000, 0x0000, buf, len,
220 HZ * USB_CTRL_GET_TIMEOUT); 214 USB_CTRL_GET_TIMEOUT);
221 debug_data(dev, __func__, len, buf, result); 215 debug_data(dev, __func__, len, buf, result);
222 216
223 /* send 5 cmd */ 217 /* send 5 cmd */
@@ -228,7 +222,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
228 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 222 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
229 0x22, 0x21, 223 0x22, 0x21,
230 0x0003, 0x0000, NULL, len, 224 0x0003, 0x0000, NULL, len,
231 HZ * USB_CTRL_GET_TIMEOUT); 225 USB_CTRL_GET_TIMEOUT);
232 dev_dbg(dev, "result = %d\n", result); 226 dev_dbg(dev, "result = %d\n", result);
233 227
234 /* send 6 cmd */ 228 /* send 6 cmd */
@@ -240,7 +234,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
240 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 234 result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
241 0x21, 0xa1, 235 0x21, 0xa1,
242 0x0000, 0x0000, buf, len, 236 0x0000, 0x0000, buf, len,
243 HZ * USB_CTRL_GET_TIMEOUT); 237 USB_CTRL_GET_TIMEOUT);
244 debug_data(dev, __func__, len, buf, result); 238 debug_data(dev, __func__, len, buf, result);
245 239
246 /* send 7 cmd */ 240 /* send 7 cmd */
@@ -259,7 +253,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
259 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 253 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
260 0x20, 0x21, 254 0x20, 0x21,
261 0x0000, 0x0000, buf, len, 255 0x0000, 0x0000, buf, len,
262 HZ * USB_CTRL_GET_TIMEOUT); 256 USB_CTRL_GET_TIMEOUT);
263 debug_data(dev, __func__, len, buf, result); 257 debug_data(dev, __func__, len, buf, result);
264 258
265 /* send 8 cmd */ 259 /* send 8 cmd */
@@ -270,7 +264,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
270 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 264 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
271 0x22, 0x21, 265 0x22, 0x21,
272 0x0003, 0x0000, NULL, len, 266 0x0003, 0x0000, NULL, len,
273 HZ * USB_CTRL_GET_TIMEOUT); 267 USB_CTRL_GET_TIMEOUT);
274 dev_dbg(dev, "result = %d\n", result); 268 dev_dbg(dev, "result = %d\n", result);
275 269
276 kfree(buf); 270 kfree(buf);
@@ -279,11 +273,29 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port)
279} 273}
280 274
281static const struct usb_device_id id_table[] = { 275static const struct usb_device_id id_table[] = {
282 { USB_DEVICE(0x19d2, 0xffff) }, /* AC8700 */ 276 /* AC8710, AC8710T */
283 { USB_DEVICE(0x19d2, 0xfffe) }, 277 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffff, 0xff, 0xff, 0xff) },
284 { USB_DEVICE(0x19d2, 0xfffd) }, /* MG880 */ 278 /* AC8700 */
279 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfffe, 0xff, 0xff, 0xff) },
280 /* MG880 */
281 { USB_DEVICE(0x19d2, 0xfffd) },
282 { USB_DEVICE(0x19d2, 0xfffc) },
283 { USB_DEVICE(0x19d2, 0xfffb) },
284 /* AC2726, AC8710_V3 */
285 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfff1, 0xff, 0xff, 0xff) },
286 { USB_DEVICE(0x19d2, 0xfff6) },
287 { USB_DEVICE(0x19d2, 0xfff7) },
288 { USB_DEVICE(0x19d2, 0xfff8) },
289 { USB_DEVICE(0x19d2, 0xfff9) },
290 { USB_DEVICE(0x19d2, 0xffee) },
291 /* AC2716, MC2716 */
292 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffed, 0xff, 0xff, 0xff) },
293 /* AD3812 */
294 { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffeb, 0xff, 0xff, 0xff) },
295 { USB_DEVICE(0x19d2, 0xffec) },
285 { USB_DEVICE(0x05C6, 0x3197) }, 296 { USB_DEVICE(0x05C6, 0x3197) },
286 { USB_DEVICE(0x05C6, 0x6000) }, 297 { USB_DEVICE(0x05C6, 0x6000) },
298 { USB_DEVICE(0x05C6, 0x9008) },
287 { }, 299 { },
288}; 300};
289MODULE_DEVICE_TABLE(usb, id_table); 301MODULE_DEVICE_TABLE(usb, id_table);