aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-06 12:48:31 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-06 12:48:31 -0400
commitc87985a3ce723995fc7b25e598238d67154108a1 (patch)
treee60def1b77c25c1d74180f62e8a5603f9826f209 /drivers/usb/serial
parentd155255a344c417acad74156654295a2964e6b81 (diff)
parent0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff)
Merge tty-next into 3.6-rc1
This handles the merge issue in: arch/um/drivers/line.c arch/um/drivers/line.h And resolves the duplicate patches that were in both trees do to the tty-next branch not getting merged into 3.6-rc1. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/keyspan.c31
-rw-r--r--drivers/usb/serial/option.c90
-rw-r--r--drivers/usb/serial/qcserial.c125
-rw-r--r--drivers/usb/serial/quatech2.c4
-rw-r--r--drivers/usb/serial/sierra.c3
5 files changed, 142 insertions, 111 deletions
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 6225199119c0..7bcbb47e1449 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -176,7 +176,7 @@ static void keyspan_set_termios(struct tty_struct *tty,
176 tty_encode_baud_rate(tty, baud_rate, baud_rate); 176 tty_encode_baud_rate(tty, baud_rate, baud_rate);
177 /* set CTS/RTS handshake etc. */ 177 /* set CTS/RTS handshake etc. */
178 p_priv->cflag = cflag; 178 p_priv->cflag = cflag;
179 p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; 179 p_priv->flow_control = (cflag & CRTSCTS) ? flow_cts : flow_none;
180 180
181 /* Mark/Space not supported */ 181 /* Mark/Space not supported */
182 tty->termios.c_cflag &= ~CMSPAR; 182 tty->termios.c_cflag &= ~CMSPAR;
@@ -474,7 +474,7 @@ static void usa28_indat_callback(struct urb *urb)
474 p_priv = usb_get_serial_port_data(port); 474 p_priv = usb_get_serial_port_data(port);
475 data = urb->transfer_buffer; 475 data = urb->transfer_buffer;
476 476
477 tty =tty_port_tty_get(&port->port); 477 tty = tty_port_tty_get(&port->port);
478 if (tty && urb->actual_length) { 478 if (tty && urb->actual_length) {
479 tty_insert_flip_string(tty, data, urb->actual_length); 479 tty_insert_flip_string(tty, data, urb->actual_length);
480 tty_flip_buffer_push(tty); 480 tty_flip_buffer_push(tty);
@@ -557,9 +557,9 @@ static void usa28_instat_callback(struct urb *urb)
557 p_priv->dcd_state = ((msg->dcd) ? 1 : 0); 557 p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
558 p_priv->ri_state = ((msg->ri) ? 1 : 0); 558 p_priv->ri_state = ((msg->ri) ? 1 : 0);
559 559
560 if( old_dcd_state != p_priv->dcd_state && old_dcd_state) { 560 if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
561 tty = tty_port_tty_get(&port->port); 561 tty = tty_port_tty_get(&port->port);
562 if (tty && !C_CLOCAL(tty)) 562 if (tty && !C_CLOCAL(tty))
563 tty_hangup(tty); 563 tty_hangup(tty);
564 tty_kref_put(tty); 564 tty_kref_put(tty);
565 } 565 }
@@ -1036,15 +1036,12 @@ static int keyspan_write_room(struct tty_struct *tty)
1036static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port) 1036static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)
1037{ 1037{
1038 struct keyspan_port_private *p_priv; 1038 struct keyspan_port_private *p_priv;
1039 struct keyspan_serial_private *s_priv;
1040 struct usb_serial *serial = port->serial;
1041 const struct keyspan_device_details *d_details; 1039 const struct keyspan_device_details *d_details;
1042 int i, err; 1040 int i, err;
1043 int baud_rate, device_port; 1041 int baud_rate, device_port;
1044 struct urb *urb; 1042 struct urb *urb;
1045 unsigned int cflag = 0; 1043 unsigned int cflag = 0;
1046 1044
1047 s_priv = usb_get_serial_data(serial);
1048 p_priv = usb_get_serial_port_data(port); 1045 p_priv = usb_get_serial_port_data(port);
1049 d_details = p_priv->device_details; 1046 d_details = p_priv->device_details;
1050 1047
@@ -1102,7 +1099,7 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)
1102 } 1099 }
1103 /* set CTS/RTS handshake etc. */ 1100 /* set CTS/RTS handshake etc. */
1104 p_priv->cflag = cflag; 1101 p_priv->cflag = cflag;
1105 p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; 1102 p_priv->flow_control = (cflag & CRTSCTS) ? flow_cts : flow_none;
1106 1103
1107 keyspan_send_setup(port, 1); 1104 keyspan_send_setup(port, 1);
1108 /* mdelay(100); */ 1105 /* mdelay(100); */
@@ -1130,10 +1127,8 @@ static void keyspan_close(struct usb_serial_port *port)
1130{ 1127{
1131 int i; 1128 int i;
1132 struct usb_serial *serial = port->serial; 1129 struct usb_serial *serial = port->serial;
1133 struct keyspan_serial_private *s_priv;
1134 struct keyspan_port_private *p_priv; 1130 struct keyspan_port_private *p_priv;
1135 1131
1136 s_priv = usb_get_serial_data(serial);
1137 p_priv = usb_get_serial_port_data(port); 1132 p_priv = usb_get_serial_port_data(port);
1138 1133
1139 p_priv->rts_state = 0; 1134 p_priv->rts_state = 0;
@@ -1240,7 +1235,7 @@ static int keyspan_fake_startup(struct usb_serial *serial)
1240 1235
1241 if (request_ihex_firmware(&fw, fw_name, &serial->dev->dev)) { 1236 if (request_ihex_firmware(&fw, fw_name, &serial->dev->dev)) {
1242 dev_err(&serial->dev->dev, "Required keyspan firmware image (%s) unavailable.\n", fw_name); 1237 dev_err(&serial->dev->dev, "Required keyspan firmware image (%s) unavailable.\n", fw_name);
1243 return(1); 1238 return 1;
1244 } 1239 }
1245 1240
1246 dbg("Uploading Keyspan %s firmware.", fw_name); 1241 dbg("Uploading Keyspan %s firmware.", fw_name);
@@ -1709,7 +1704,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1709 msg.setPrescaler = 0xff; 1704 msg.setPrescaler = 0xff;
1710 } 1705 }
1711 1706
1712 msg.lcr = (p_priv->cflag & CSTOPB)? STOPBITS_678_2: STOPBITS_5678_1; 1707 msg.lcr = (p_priv->cflag & CSTOPB) ? STOPBITS_678_2 : STOPBITS_5678_1;
1713 switch (p_priv->cflag & CSIZE) { 1708 switch (p_priv->cflag & CSIZE) {
1714 case CS5: 1709 case CS5:
1715 msg.lcr |= USA_DATABITS_5; 1710 msg.lcr |= USA_DATABITS_5;
@@ -1726,7 +1721,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1726 } 1721 }
1727 if (p_priv->cflag & PARENB) { 1722 if (p_priv->cflag & PARENB) {
1728 /* note USA_PARITY_NONE == 0 */ 1723 /* note USA_PARITY_NONE == 0 */
1729 msg.lcr |= (p_priv->cflag & PARODD)? 1724 msg.lcr |= (p_priv->cflag & PARODD) ?
1730 USA_PARITY_ODD : USA_PARITY_EVEN; 1725 USA_PARITY_ODD : USA_PARITY_EVEN;
1731 } 1726 }
1732 msg.setLcr = 0xff; 1727 msg.setLcr = 0xff;
@@ -1994,7 +1989,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
1994 /* msg.setPrescaler = 0xff; */ 1989 /* msg.setPrescaler = 0xff; */
1995 } 1990 }
1996 1991
1997 msg.lcr = (p_priv->cflag & CSTOPB)? STOPBITS_678_2: STOPBITS_5678_1; 1992 msg.lcr = (p_priv->cflag & CSTOPB) ? STOPBITS_678_2 : STOPBITS_5678_1;
1998 switch (p_priv->cflag & CSIZE) { 1993 switch (p_priv->cflag & CSIZE) {
1999 case CS5: 1994 case CS5:
2000 msg.lcr |= USA_DATABITS_5; 1995 msg.lcr |= USA_DATABITS_5;
@@ -2011,7 +2006,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
2011 } 2006 }
2012 if (p_priv->cflag & PARENB) { 2007 if (p_priv->cflag & PARENB) {
2013 /* note USA_PARITY_NONE == 0 */ 2008 /* note USA_PARITY_NONE == 0 */
2014 msg.lcr |= (p_priv->cflag & PARODD)? 2009 msg.lcr |= (p_priv->cflag & PARODD) ?
2015 USA_PARITY_ODD : USA_PARITY_EVEN; 2010 USA_PARITY_ODD : USA_PARITY_EVEN;
2016 } 2011 }
2017 msg.setLcr = 0xff; 2012 msg.setLcr = 0xff;
@@ -2178,7 +2173,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
2178 msg.txMode = TXMODE_BYHAND; 2173 msg.txMode = TXMODE_BYHAND;
2179 } 2174 }
2180 2175
2181 msg.lcr = (p_priv->cflag & CSTOPB)? STOPBITS_678_2: STOPBITS_5678_1; 2176 msg.lcr = (p_priv->cflag & CSTOPB) ? STOPBITS_678_2 : STOPBITS_5678_1;
2182 switch (p_priv->cflag & CSIZE) { 2177 switch (p_priv->cflag & CSIZE) {
2183 case CS5: 2178 case CS5:
2184 msg.lcr |= USA_DATABITS_5; 2179 msg.lcr |= USA_DATABITS_5;
@@ -2195,7 +2190,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
2195 } 2190 }
2196 if (p_priv->cflag & PARENB) { 2191 if (p_priv->cflag & PARENB) {
2197 /* note USA_PARITY_NONE == 0 */ 2192 /* note USA_PARITY_NONE == 0 */
2198 msg.lcr |= (p_priv->cflag & PARODD)? 2193 msg.lcr |= (p_priv->cflag & PARODD) ?
2199 USA_PARITY_ODD : USA_PARITY_EVEN; 2194 USA_PARITY_ODD : USA_PARITY_EVEN;
2200 } 2195 }
2201 if (p_priv->old_cflag != p_priv->cflag) { 2196 if (p_priv->old_cflag != p_priv->cflag) {
@@ -2322,7 +2317,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
2322 } 2317 }
2323 if (p_priv->cflag & PARENB) { 2318 if (p_priv->cflag & PARENB) {
2324 /* note USA_PARITY_NONE == 0 */ 2319 /* note USA_PARITY_NONE == 0 */
2325 msg.lcr |= (p_priv->cflag & PARODD)? 2320 msg.lcr |= (p_priv->cflag & PARODD) ?
2326 USA_PARITY_ODD : USA_PARITY_EVEN; 2321 USA_PARITY_ODD : USA_PARITY_EVEN;
2327 } 2322 }
2328 msg.setLcr = 0xff; 2323 msg.setLcr = 0xff;
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 417ab1b0aa30..08ff9b862049 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -936,6 +936,8 @@ static const struct usb_device_id option_ids[] = {
936 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) }, 936 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
937 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff), 937 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff),
938 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 938 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
939 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff),
940 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
939 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), 941 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
940 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 942 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
941 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff), 943 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
@@ -1310,6 +1312,10 @@ static struct usb_serial_driver * const serial_drivers[] = {
1310 1312
1311static bool debug; 1313static bool debug;
1312 1314
1315struct option_private {
1316 u8 bInterfaceNumber;
1317};
1318
1313module_usb_serial_driver(serial_drivers, option_ids); 1319module_usb_serial_driver(serial_drivers, option_ids);
1314 1320
1315static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, 1321static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason,
@@ -1340,51 +1346,78 @@ static int option_probe(struct usb_serial *serial,
1340 const struct usb_device_id *id) 1346 const struct usb_device_id *id)
1341{ 1347{
1342 struct usb_wwan_intf_private *data; 1348 struct usb_wwan_intf_private *data;
1343 1349 struct option_private *priv;
1344 /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */ 1350 struct usb_interface_descriptor *iface_desc =
1345 if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID && 1351 &serial->interface->cur_altsetting->desc;
1346 serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 && 1352 struct usb_device_descriptor *dev_desc = &serial->dev->descriptor;
1347 serial->interface->cur_altsetting->desc.bInterfaceClass == 0x8) 1353
1354 /*
1355 * D-Link DWM 652 still exposes CD-Rom emulation interface in modem
1356 * mode.
1357 */
1358 if (dev_desc->idVendor == DLINK_VENDOR_ID &&
1359 dev_desc->idProduct == DLINK_PRODUCT_DWM_652 &&
1360 iface_desc->bInterfaceClass == 0x08)
1348 return -ENODEV; 1361 return -ENODEV;
1349 1362
1350 /* Bandrich modem and AT command interface is 0xff */ 1363 /* Bandrich modem and AT command interface is 0xff */
1351 if ((serial->dev->descriptor.idVendor == BANDRICH_VENDOR_ID || 1364 if ((dev_desc->idVendor == BANDRICH_VENDOR_ID ||
1352 serial->dev->descriptor.idVendor == PIRELLI_VENDOR_ID) && 1365 dev_desc->idVendor == PIRELLI_VENDOR_ID) &&
1353 serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff) 1366 iface_desc->bInterfaceClass != 0xff)
1354 return -ENODEV; 1367 return -ENODEV;
1355 1368 /*
1356 /* Don't bind reserved interfaces (like network ones) which often have 1369 * Don't bind reserved interfaces (like network ones) which often have
1357 * the same class/subclass/protocol as the serial interfaces. Look at 1370 * the same class/subclass/protocol as the serial interfaces. Look at
1358 * the Windows driver .INF files for reserved interface numbers. 1371 * the Windows driver .INF files for reserved interface numbers.
1359 */ 1372 */
1360 if (is_blacklisted( 1373 if (is_blacklisted(
1361 serial->interface->cur_altsetting->desc.bInterfaceNumber, 1374 iface_desc->bInterfaceNumber,
1362 OPTION_BLACKLIST_RESERVED_IF, 1375 OPTION_BLACKLIST_RESERVED_IF,
1363 (const struct option_blacklist_info *) id->driver_info)) 1376 (const struct option_blacklist_info *) id->driver_info))
1364 return -ENODEV; 1377 return -ENODEV;
1365 1378 /*
1366 /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */ 1379 * Don't bind network interface on Samsung GT-B3730, it is handled by
1367 if (serial->dev->descriptor.idVendor == SAMSUNG_VENDOR_ID && 1380 * a separate module.
1368 serial->dev->descriptor.idProduct == SAMSUNG_PRODUCT_GT_B3730 && 1381 */
1369 serial->interface->cur_altsetting->desc.bInterfaceClass != USB_CLASS_CDC_DATA) 1382 if (dev_desc->idVendor == SAMSUNG_VENDOR_ID &&
1383 dev_desc->idProduct == SAMSUNG_PRODUCT_GT_B3730 &&
1384 iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA)
1370 return -ENODEV; 1385 return -ENODEV;
1371 1386
1372 data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); 1387 data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
1373 if (!data) 1388 if (!data)
1374 return -ENOMEM; 1389 return -ENOMEM;
1375 data->send_setup = option_send_setup; 1390
1391 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
1392 if (!priv) {
1393 kfree(data);
1394 return -ENOMEM;
1395 }
1396
1397 priv->bInterfaceNumber = iface_desc->bInterfaceNumber;
1398 data->private = priv;
1399
1400 if (!is_blacklisted(iface_desc->bInterfaceNumber,
1401 OPTION_BLACKLIST_SENDSETUP,
1402 (struct option_blacklist_info *)id->driver_info)) {
1403 data->send_setup = option_send_setup;
1404 }
1376 spin_lock_init(&data->susp_lock); 1405 spin_lock_init(&data->susp_lock);
1377 data->private = (void *)id->driver_info; 1406
1407 usb_set_serial_data(serial, data);
1408
1378 return 0; 1409 return 0;
1379} 1410}
1380 1411
1381static void option_release(struct usb_serial *serial) 1412static void option_release(struct usb_serial *serial)
1382{ 1413{
1383 struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); 1414 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
1415 struct option_private *priv = intfdata->private;
1384 1416
1385 usb_wwan_release(serial); 1417 usb_wwan_release(serial);
1386 1418
1387 kfree(priv); 1419 kfree(priv);
1420 kfree(intfdata);
1388} 1421}
1389 1422
1390static void option_instat_callback(struct urb *urb) 1423static void option_instat_callback(struct urb *urb)
@@ -1451,18 +1484,11 @@ static void option_instat_callback(struct urb *urb)
1451static int option_send_setup(struct usb_serial_port *port) 1484static int option_send_setup(struct usb_serial_port *port)
1452{ 1485{
1453 struct usb_serial *serial = port->serial; 1486 struct usb_serial *serial = port->serial;
1454 struct usb_wwan_intf_private *intfdata = 1487 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
1455 (struct usb_wwan_intf_private *) serial->private; 1488 struct option_private *priv = intfdata->private;
1456 struct usb_wwan_port_private *portdata; 1489 struct usb_wwan_port_private *portdata;
1457 int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber;
1458 int val = 0; 1490 int val = 0;
1459 1491
1460 if (is_blacklisted(ifNum, OPTION_BLACKLIST_SENDSETUP,
1461 (struct option_blacklist_info *) intfdata->private)) {
1462 dbg("No send_setup on blacklisted interface #%d\n", ifNum);
1463 return -EIO;
1464 }
1465
1466 portdata = usb_get_serial_port_data(port); 1492 portdata = usb_get_serial_port_data(port);
1467 1493
1468 if (portdata->dtr_state) 1494 if (portdata->dtr_state)
@@ -1470,9 +1496,9 @@ static int option_send_setup(struct usb_serial_port *port)
1470 if (portdata->rts_state) 1496 if (portdata->rts_state)
1471 val |= 0x02; 1497 val |= 0x02;
1472 1498
1473 return usb_control_msg(serial->dev, 1499 return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
1474 usb_rcvctrlpipe(serial->dev, 0), 1500 0x22, 0x21, val, priv->bInterfaceNumber, NULL,
1475 0x22, 0x21, val, ifNum, NULL, 0, USB_CTRL_SET_TIMEOUT); 1501 0, USB_CTRL_SET_TIMEOUT);
1476} 1502}
1477 1503
1478MODULE_AUTHOR(DRIVER_AUTHOR); 1504MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 996015c5f1ac..8d103019d6aa 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -105,6 +105,10 @@ static const struct usb_device_id id_table[] = {
105 {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */ 105 {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */
106 {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */ 106 {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */
107 {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ 107 {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */
108 {USB_DEVICE(0x1199, 0x68a4)}, /* Sierra Wireless QDL */
109 {USB_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */
110 {USB_DEVICE(0x1199, 0x68a8)}, /* Sierra Wireless QDL */
111 {USB_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */
108 {USB_DEVICE(0x1199, 0x9010)}, /* Sierra Wireless Gobi 3000 QDL */ 112 {USB_DEVICE(0x1199, 0x9010)}, /* Sierra Wireless Gobi 3000 QDL */
109 {USB_DEVICE(0x1199, 0x9012)}, /* Sierra Wireless Gobi 3000 QDL */ 113 {USB_DEVICE(0x1199, 0x9012)}, /* Sierra Wireless Gobi 3000 QDL */
110 {USB_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ 114 {USB_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
@@ -112,8 +116,24 @@ static const struct usb_device_id id_table[] = {
112 {USB_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ 116 {USB_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
113 {USB_DEVICE(0x1199, 0x9018)}, /* Sierra Wireless Gobi 3000 QDL */ 117 {USB_DEVICE(0x1199, 0x9018)}, /* Sierra Wireless Gobi 3000 QDL */
114 {USB_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ 118 {USB_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
119 {USB_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */
115 {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */ 120 {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */
116 {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */ 121 {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */
122
123 /* non Gobi Qualcomm serial devices */
124 {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 0)}, /* Sierra Wireless MC7700 Device Management */
125 {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 2)}, /* Sierra Wireless MC7700 NMEA */
126 {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 3)}, /* Sierra Wireless MC7700 Modem */
127 {USB_DEVICE_INTERFACE_NUMBER(0x114f, 0x68a2, 0)}, /* Sierra Wireless MC7750 Device Management */
128 {USB_DEVICE_INTERFACE_NUMBER(0x114f, 0x68a2, 2)}, /* Sierra Wireless MC7750 NMEA */
129 {USB_DEVICE_INTERFACE_NUMBER(0x114f, 0x68a2, 3)}, /* Sierra Wireless MC7750 Modem */
130 {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 0)}, /* Sierra Wireless MC7710 Device Management */
131 {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 2)}, /* Sierra Wireless MC7710 NMEA */
132 {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 3)}, /* Sierra Wireless MC7710 Modem */
133 {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 0)}, /* Sierra Wireless EM7700 Device Management */
134 {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 2)}, /* Sierra Wireless EM7700 NMEA */
135 {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 3)}, /* Sierra Wireless EM7700 Modem */
136
117 { } /* Terminating entry */ 137 { } /* Terminating entry */
118}; 138};
119MODULE_DEVICE_TABLE(usb, id_table); 139MODULE_DEVICE_TABLE(usb, id_table);
@@ -127,6 +147,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
127 __u8 nintf; 147 __u8 nintf;
128 __u8 ifnum; 148 __u8 ifnum;
129 bool is_gobi1k = id->driver_info ? true : false; 149 bool is_gobi1k = id->driver_info ? true : false;
150 int altsetting = -1;
130 151
131 dev_dbg(dev, "Is Gobi 1000 = %d\n", is_gobi1k); 152 dev_dbg(dev, "Is Gobi 1000 = %d\n", is_gobi1k);
132 153
@@ -142,38 +163,43 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
142 163
143 spin_lock_init(&data->susp_lock); 164 spin_lock_init(&data->susp_lock);
144 165
145 switch (nintf) { 166 if (nintf == 1) {
146 case 1:
147 /* QDL mode */ 167 /* QDL mode */
148 /* Gobi 2000 has a single altsetting, older ones have two */ 168 /* Gobi 2000 has a single altsetting, older ones have two */
149 if (serial->interface->num_altsetting == 2) 169 if (serial->interface->num_altsetting == 2)
150 intf = &serial->interface->altsetting[1]; 170 intf = &serial->interface->altsetting[1];
151 else if (serial->interface->num_altsetting > 2) 171 else if (serial->interface->num_altsetting > 2)
152 break; 172 goto done;
153 173
154 if (intf->desc.bNumEndpoints == 2 && 174 if (intf->desc.bNumEndpoints == 2 &&
155 usb_endpoint_is_bulk_in(&intf->endpoint[0].desc) && 175 usb_endpoint_is_bulk_in(&intf->endpoint[0].desc) &&
156 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) { 176 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
157 dev_dbg(dev, "QDL port found\n"); 177 dev_dbg(dev, "QDL port found\n");
158 178
159 if (serial->interface->num_altsetting == 1) { 179 if (serial->interface->num_altsetting == 1)
160 retval = 0; /* Success */ 180 retval = 0; /* Success */
161 break; 181 else
162 } 182 altsetting = 1;
163
164 retval = usb_set_interface(serial->dev, ifnum, 1);
165 if (retval < 0) {
166 dev_err(dev,
167 "Could not set interface, error %d\n",
168 retval);
169 retval = -ENODEV;
170 kfree(data);
171 }
172 } 183 }
173 break; 184 goto done;
174 185
175 case 3: 186 }
176 case 4: 187
188 /* allow any number of interfaces when doing direct interface match */
189 if (id->match_flags & USB_DEVICE_ID_MATCH_INT_NUMBER) {
190 dev_dbg(dev, "Generic Qualcomm serial interface found\n");
191 altsetting = 0;
192 goto done;
193 }
194
195 if (nintf < 3 || nintf > 4) {
196 dev_err(dev, "unknown number of interfaces: %d\n", nintf);
197 goto done;
198 }
199
200 /* default to enabling interface */
201 altsetting = 0;
202 switch (ifnum) {
177 /* Composite mode; don't bind to the QMI/net interface as that 203 /* Composite mode; don't bind to the QMI/net interface as that
178 * gets handled by other drivers. 204 * gets handled by other drivers.
179 */ 205 */
@@ -191,53 +217,44 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
191 * 3: NMEA 217 * 3: NMEA
192 */ 218 */
193 219
194 if (ifnum == 1 && !is_gobi1k) { 220 case 1:
221 if (is_gobi1k)
222 altsetting = -1;
223 else
195 dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n"); 224 dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n");
196 retval = usb_set_interface(serial->dev, ifnum, 0); 225 break;
197 if (retval < 0) { 226 case 2:
198 dev_err(dev, 227 dev_dbg(dev, "Modem port found\n");
199 "Could not set interface, error %d\n", 228 break;
200 retval); 229 case 3:
201 retval = -ENODEV; 230 if (is_gobi1k)
202 kfree(data); 231 altsetting = -1;
203 } 232 else
204 } else if (ifnum == 2) {
205 dev_dbg(dev, "Modem port found\n");
206 retval = usb_set_interface(serial->dev, ifnum, 0);
207 if (retval < 0) {
208 dev_err(dev,
209 "Could not set interface, error %d\n",
210 retval);
211 retval = -ENODEV;
212 kfree(data);
213 }
214 } else if (ifnum==3 && !is_gobi1k) {
215 /* 233 /*
216 * NMEA (serial line 9600 8N1) 234 * NMEA (serial line 9600 8N1)
217 * # echo "\$GPS_START" > /dev/ttyUSBx 235 * # echo "\$GPS_START" > /dev/ttyUSBx
218 * # echo "\$GPS_STOP" > /dev/ttyUSBx 236 * # echo "\$GPS_STOP" > /dev/ttyUSBx
219 */ 237 */
220 dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n"); 238 dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n");
221 retval = usb_set_interface(serial->dev, ifnum, 0); 239 }
222 if (retval < 0) {
223 dev_err(dev,
224 "Could not set interface, error %d\n",
225 retval);
226 retval = -ENODEV;
227 kfree(data);
228 }
229 }
230 break;
231 240
232 default: 241done:
233 dev_err(dev, "unknown number of interfaces: %d\n", nintf); 242 if (altsetting >= 0) {
234 kfree(data); 243 retval = usb_set_interface(serial->dev, ifnum, altsetting);
235 retval = -ENODEV; 244 if (retval < 0) {
245 dev_err(dev,
246 "Could not set interface, error %d\n",
247 retval);
248 retval = -ENODEV;
249 }
236 } 250 }
237 251
238 /* Set serial->private if not returning -ENODEV */ 252 /* Set serial->private if not returning error */
239 if (retval != -ENODEV) 253 if (retval == 0)
240 usb_set_serial_data(serial, data); 254 usb_set_serial_data(serial, data);
255 else
256 kfree(data);
257
241 return retval; 258 return retval;
242} 259}
243 260
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 7de6d491a859..7df9cdb053ed 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -345,7 +345,6 @@ static void qt2_set_termios(struct tty_struct *tty,
345static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port) 345static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
346{ 346{
347 struct usb_serial *serial; 347 struct usb_serial *serial;
348 struct qt2_serial_private *serial_priv;
349 struct qt2_port_private *port_priv; 348 struct qt2_port_private *port_priv;
350 u8 *data; 349 u8 *data;
351 u16 device_port; 350 u16 device_port;
@@ -357,7 +356,6 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
357 serial = port->serial; 356 serial = port->serial;
358 357
359 port_priv = usb_get_serial_port_data(port); 358 port_priv = usb_get_serial_port_data(port);
360 serial_priv = usb_get_serial_data(serial);
361 359
362 /* set the port to RS232 mode */ 360 /* set the port to RS232 mode */
363 status = qt2_control_msg(serial->dev, QT2_GET_SET_QMCR, 361 status = qt2_control_msg(serial->dev, QT2_GET_SET_QMCR,
@@ -417,13 +415,11 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
417static void qt2_close(struct usb_serial_port *port) 415static void qt2_close(struct usb_serial_port *port)
418{ 416{
419 struct usb_serial *serial; 417 struct usb_serial *serial;
420 struct qt2_serial_private *serial_priv;
421 struct qt2_port_private *port_priv; 418 struct qt2_port_private *port_priv;
422 unsigned long flags; 419 unsigned long flags;
423 int i; 420 int i;
424 421
425 serial = port->serial; 422 serial = port->serial;
426 serial_priv = usb_get_serial_data(serial);
427 port_priv = usb_get_serial_port_data(port); 423 port_priv = usb_get_serial_port_data(port);
428 424
429 port_priv->is_open = false; 425 port_priv->is_open = false;
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index a4e4f3a16c63..b14ebbd73567 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -288,9 +288,6 @@ static const struct usb_device_id id_table[] = {
288 /* Sierra Wireless HSPA Non-Composite Device */ 288 /* Sierra Wireless HSPA Non-Composite Device */
289 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, 289 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)},
290 { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ 290 { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */
291 { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */
292 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
293 },
294 { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ 291 { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */
295 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist 292 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
296 }, 293 },