aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ftdi_sio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 17:19:17 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 17:19:17 -0400
commit50f732ee63b91eb08a29974b36bd63e1150bb642 (patch)
treefdfc63411a34ffbe26a3b0a997aaeff742a0301b /drivers/usb/serial/ftdi_sio.c
parentaa5bc2b58e3344da57f26b62e99e13e91c9e0a94 (diff)
parenta7205b30106a2d4ee268132644cdb292da2d9b41 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (78 commits) USB: update MAINAINERS and CREDITS for Freescale USB driver USB: update gadget files for fsl_usb2_udc driver USB: add Freescale high-speed USB SOC device controller driver USB: quirk for broken suspend of IT8152F/G USB: iowarrior.c: timeouts too small in usb_control_msg calls USB: dell device id for option.c USB: Remove Huawei unusual_devs entry USB: CP2101 New Device IDs USB: add picdem device to ldusb usbfs micro optimitation USB: remove ancient/broken CRIS hcd usb ethernet gadget, workaround network stack API glitch USB: add "busnum" attribute for USB devices USB: cxacru: ADSL state management usbatm: Detect usb device shutdown and ignore failed urbs USB: Remove duplicate define of OHCI_QUIRK_ZFMICRO USB: BandRich BandLuxe HSDPA Data Card Driver USB gadget rndis: fix struct rndis_packet_msg_type unaligned bug USB Elan FTDI: check for driver registration status USB: sierra: add more checks on shutdown ...
Diffstat (limited to 'drivers/usb/serial/ftdi_sio.c')
-rw-r--r--drivers/usb/serial/ftdi_sio.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 8ff9d54b21e6..95a1805b064f 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -342,6 +342,7 @@ static struct usb_device_id id_table_combined [] = {
342 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, 342 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
343 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, 343 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
344 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, 344 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
345 { USB_DEVICE(FTDI_VID, FTDI_USBX_707_PID) },
345 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, 346 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) },
346 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, 347 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) },
347 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, 348 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) },
@@ -1433,6 +1434,7 @@ static int ftdi_write (struct usb_serial_port *port,
1433 dbg("%s - write limit hit\n", __FUNCTION__); 1434 dbg("%s - write limit hit\n", __FUNCTION__);
1434 return 0; 1435 return 0;
1435 } 1436 }
1437 priv->tx_outstanding_urbs++;
1436 spin_unlock_irqrestore(&priv->tx_lock, flags); 1438 spin_unlock_irqrestore(&priv->tx_lock, flags);
1437 1439
1438 data_offset = priv->write_offset; 1440 data_offset = priv->write_offset;
@@ -1450,14 +1452,15 @@ static int ftdi_write (struct usb_serial_port *port,
1450 buffer = kmalloc (transfer_size, GFP_ATOMIC); 1452 buffer = kmalloc (transfer_size, GFP_ATOMIC);
1451 if (!buffer) { 1453 if (!buffer) {
1452 err("%s ran out of kernel memory for urb ...", __FUNCTION__); 1454 err("%s ran out of kernel memory for urb ...", __FUNCTION__);
1453 return -ENOMEM; 1455 count = -ENOMEM;
1456 goto error_no_buffer;
1454 } 1457 }
1455 1458
1456 urb = usb_alloc_urb(0, GFP_ATOMIC); 1459 urb = usb_alloc_urb(0, GFP_ATOMIC);
1457 if (!urb) { 1460 if (!urb) {
1458 err("%s - no more free urbs", __FUNCTION__); 1461 err("%s - no more free urbs", __FUNCTION__);
1459 kfree (buffer); 1462 count = -ENOMEM;
1460 return -ENOMEM; 1463 goto error_no_urb;
1461 } 1464 }
1462 1465
1463 /* Copy data */ 1466 /* Copy data */
@@ -1499,10 +1502,9 @@ static int ftdi_write (struct usb_serial_port *port,
1499 if (status) { 1502 if (status) {
1500 err("%s - failed submitting write urb, error %d", __FUNCTION__, status); 1503 err("%s - failed submitting write urb, error %d", __FUNCTION__, status);
1501 count = status; 1504 count = status;
1502 kfree (buffer); 1505 goto error;
1503 } else { 1506 } else {
1504 spin_lock_irqsave(&priv->tx_lock, flags); 1507 spin_lock_irqsave(&priv->tx_lock, flags);
1505 ++priv->tx_outstanding_urbs;
1506 priv->tx_outstanding_bytes += count; 1508 priv->tx_outstanding_bytes += count;
1507 priv->tx_bytes += count; 1509 priv->tx_bytes += count;
1508 spin_unlock_irqrestore(&priv->tx_lock, flags); 1510 spin_unlock_irqrestore(&priv->tx_lock, flags);
@@ -1510,10 +1512,19 @@ static int ftdi_write (struct usb_serial_port *port,
1510 1512
1511 /* we are done with this urb, so let the host driver 1513 /* we are done with this urb, so let the host driver
1512 * really free it when it is finished with it */ 1514 * really free it when it is finished with it */
1513 usb_free_urb (urb); 1515 usb_free_urb(urb);
1514 1516
1515 dbg("%s write returning: %d", __FUNCTION__, count); 1517 dbg("%s write returning: %d", __FUNCTION__, count);
1516 return count; 1518 return count;
1519error:
1520 usb_free_urb(urb);
1521error_no_urb:
1522 kfree (buffer);
1523error_no_buffer:
1524 spin_lock_irqsave(&priv->tx_lock, flags);
1525 priv->tx_outstanding_urbs--;
1526 spin_unlock_irqrestore(&priv->tx_lock, flags);
1527 return count;
1517} /* ftdi_write */ 1528} /* ftdi_write */
1518 1529
1519 1530