diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-16 16:16:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-16 16:16:09 -0400 |
commit | b903bd69e3fa156598def8d6433dfe5352af8da3 (patch) | |
tree | a13380f31bab62acfd667910656525c09511cb8a /drivers/usb/serial/option.c | |
parent | 84a1caf1453c3d44050bd22db958af4a7f99315c (diff) | |
parent | 1a49e2ac9651df7349867a5cf44e2c83de1046af (diff) |
Merge 3.5-rc7 into usb-next
This resolves the merge issue with the drivers/usb/host/ehci-omap.c
file.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/option.c')
-rw-r--r-- | drivers/usb/serial/option.c | 88 |
1 files changed, 56 insertions, 32 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 417ab1b0aa30..2b0c88da7828 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -1310,6 +1310,10 @@ static struct usb_serial_driver * const serial_drivers[] = { | |||
1310 | 1310 | ||
1311 | static bool debug; | 1311 | static bool debug; |
1312 | 1312 | ||
1313 | struct option_private { | ||
1314 | u8 bInterfaceNumber; | ||
1315 | }; | ||
1316 | |||
1313 | module_usb_serial_driver(serial_drivers, option_ids); | 1317 | module_usb_serial_driver(serial_drivers, option_ids); |
1314 | 1318 | ||
1315 | static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, | 1319 | static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, |
@@ -1340,51 +1344,78 @@ static int option_probe(struct usb_serial *serial, | |||
1340 | const struct usb_device_id *id) | 1344 | const struct usb_device_id *id) |
1341 | { | 1345 | { |
1342 | struct usb_wwan_intf_private *data; | 1346 | struct usb_wwan_intf_private *data; |
1343 | 1347 | struct option_private *priv; | |
1344 | /* D-Link DWM 652 still exposes CD-Rom emulation interface in modem mode */ | 1348 | struct usb_interface_descriptor *iface_desc = |
1345 | if (serial->dev->descriptor.idVendor == DLINK_VENDOR_ID && | 1349 | &serial->interface->cur_altsetting->desc; |
1346 | serial->dev->descriptor.idProduct == DLINK_PRODUCT_DWM_652 && | 1350 | struct usb_device_descriptor *dev_desc = &serial->dev->descriptor; |
1347 | serial->interface->cur_altsetting->desc.bInterfaceClass == 0x8) | 1351 | |
1352 | /* | ||
1353 | * D-Link DWM 652 still exposes CD-Rom emulation interface in modem | ||
1354 | * mode. | ||
1355 | */ | ||
1356 | if (dev_desc->idVendor == DLINK_VENDOR_ID && | ||
1357 | dev_desc->idProduct == DLINK_PRODUCT_DWM_652 && | ||
1358 | iface_desc->bInterfaceClass == 0x08) | ||
1348 | return -ENODEV; | 1359 | return -ENODEV; |
1349 | 1360 | ||
1350 | /* Bandrich modem and AT command interface is 0xff */ | 1361 | /* Bandrich modem and AT command interface is 0xff */ |
1351 | if ((serial->dev->descriptor.idVendor == BANDRICH_VENDOR_ID || | 1362 | if ((dev_desc->idVendor == BANDRICH_VENDOR_ID || |
1352 | serial->dev->descriptor.idVendor == PIRELLI_VENDOR_ID) && | 1363 | dev_desc->idVendor == PIRELLI_VENDOR_ID) && |
1353 | serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff) | 1364 | iface_desc->bInterfaceClass != 0xff) |
1354 | return -ENODEV; | 1365 | return -ENODEV; |
1355 | 1366 | /* | |
1356 | /* Don't bind reserved interfaces (like network ones) which often have | 1367 | * Don't bind reserved interfaces (like network ones) which often have |
1357 | * the same class/subclass/protocol as the serial interfaces. Look at | 1368 | * the same class/subclass/protocol as the serial interfaces. Look at |
1358 | * the Windows driver .INF files for reserved interface numbers. | 1369 | * the Windows driver .INF files for reserved interface numbers. |
1359 | */ | 1370 | */ |
1360 | if (is_blacklisted( | 1371 | if (is_blacklisted( |
1361 | serial->interface->cur_altsetting->desc.bInterfaceNumber, | 1372 | iface_desc->bInterfaceNumber, |
1362 | OPTION_BLACKLIST_RESERVED_IF, | 1373 | OPTION_BLACKLIST_RESERVED_IF, |
1363 | (const struct option_blacklist_info *) id->driver_info)) | 1374 | (const struct option_blacklist_info *) id->driver_info)) |
1364 | return -ENODEV; | 1375 | return -ENODEV; |
1365 | 1376 | /* | |
1366 | /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */ | 1377 | * Don't bind network interface on Samsung GT-B3730, it is handled by |
1367 | if (serial->dev->descriptor.idVendor == SAMSUNG_VENDOR_ID && | 1378 | * a separate module. |
1368 | serial->dev->descriptor.idProduct == SAMSUNG_PRODUCT_GT_B3730 && | 1379 | */ |
1369 | serial->interface->cur_altsetting->desc.bInterfaceClass != USB_CLASS_CDC_DATA) | 1380 | if (dev_desc->idVendor == SAMSUNG_VENDOR_ID && |
1381 | dev_desc->idProduct == SAMSUNG_PRODUCT_GT_B3730 && | ||
1382 | iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA) | ||
1370 | return -ENODEV; | 1383 | return -ENODEV; |
1371 | 1384 | ||
1372 | data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); | 1385 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); |
1373 | if (!data) | 1386 | if (!data) |
1374 | return -ENOMEM; | 1387 | return -ENOMEM; |
1375 | data->send_setup = option_send_setup; | 1388 | |
1389 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
1390 | if (!priv) { | ||
1391 | kfree(data); | ||
1392 | return -ENOMEM; | ||
1393 | } | ||
1394 | |||
1395 | priv->bInterfaceNumber = iface_desc->bInterfaceNumber; | ||
1396 | data->private = priv; | ||
1397 | |||
1398 | if (!is_blacklisted(iface_desc->bInterfaceNumber, | ||
1399 | OPTION_BLACKLIST_SENDSETUP, | ||
1400 | (struct option_blacklist_info *)id->driver_info)) { | ||
1401 | data->send_setup = option_send_setup; | ||
1402 | } | ||
1376 | spin_lock_init(&data->susp_lock); | 1403 | spin_lock_init(&data->susp_lock); |
1377 | data->private = (void *)id->driver_info; | 1404 | |
1405 | usb_set_serial_data(serial, data); | ||
1406 | |||
1378 | return 0; | 1407 | return 0; |
1379 | } | 1408 | } |
1380 | 1409 | ||
1381 | static void option_release(struct usb_serial *serial) | 1410 | static void option_release(struct usb_serial *serial) |
1382 | { | 1411 | { |
1383 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | 1412 | struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); |
1413 | struct option_private *priv = intfdata->private; | ||
1384 | 1414 | ||
1385 | usb_wwan_release(serial); | 1415 | usb_wwan_release(serial); |
1386 | 1416 | ||
1387 | kfree(priv); | 1417 | kfree(priv); |
1418 | kfree(intfdata); | ||
1388 | } | 1419 | } |
1389 | 1420 | ||
1390 | static void option_instat_callback(struct urb *urb) | 1421 | static void option_instat_callback(struct urb *urb) |
@@ -1451,18 +1482,11 @@ static void option_instat_callback(struct urb *urb) | |||
1451 | static int option_send_setup(struct usb_serial_port *port) | 1482 | static int option_send_setup(struct usb_serial_port *port) |
1452 | { | 1483 | { |
1453 | struct usb_serial *serial = port->serial; | 1484 | struct usb_serial *serial = port->serial; |
1454 | struct usb_wwan_intf_private *intfdata = | 1485 | struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); |
1455 | (struct usb_wwan_intf_private *) serial->private; | 1486 | struct option_private *priv = intfdata->private; |
1456 | struct usb_wwan_port_private *portdata; | 1487 | struct usb_wwan_port_private *portdata; |
1457 | int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber; | ||
1458 | int val = 0; | 1488 | int val = 0; |
1459 | 1489 | ||
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); | 1490 | portdata = usb_get_serial_port_data(port); |
1467 | 1491 | ||
1468 | if (portdata->dtr_state) | 1492 | if (portdata->dtr_state) |
@@ -1470,9 +1494,9 @@ static int option_send_setup(struct usb_serial_port *port) | |||
1470 | if (portdata->rts_state) | 1494 | if (portdata->rts_state) |
1471 | val |= 0x02; | 1495 | val |= 0x02; |
1472 | 1496 | ||
1473 | return usb_control_msg(serial->dev, | 1497 | return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
1474 | usb_rcvctrlpipe(serial->dev, 0), | 1498 | 0x22, 0x21, val, priv->bInterfaceNumber, NULL, |
1475 | 0x22, 0x21, val, ifNum, NULL, 0, USB_CTRL_SET_TIMEOUT); | 1499 | 0, USB_CTRL_SET_TIMEOUT); |
1476 | } | 1500 | } |
1477 | 1501 | ||
1478 | MODULE_AUTHOR(DRIVER_AUTHOR); | 1502 | MODULE_AUTHOR(DRIVER_AUTHOR); |