diff options
| author | Jeff Garzik <jgarzik@pretzel.yyz.us> | 2005-06-27 22:03:52 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-27 22:03:52 -0400 |
| commit | 716b43303df605510399d6da0d0dd4e2ea376e7c (patch) | |
| tree | 57412aaf516b7a10b4b81064aeda318514fec168 /drivers/usb/serial/safe_serial.c | |
| parent | 5696c1944a33b4434a9a1ebb6383b906afd43a10 (diff) | |
| parent | c7b645f934e52a54af58142d91fb51f881f8ce26 (diff) | |
Merge upstream ieee80211.h with us (us == branch 'ieee80211' of netdev-2.6)
Diffstat (limited to 'drivers/usb/serial/safe_serial.c')
| -rw-r--r-- | drivers/usb/serial/safe_serial.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index 0e85ed6c6c19..96a17568cbf1 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c @@ -299,10 +299,14 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i dbg ("%s - write request of 0 bytes", __FUNCTION__); return (0); } - if (port->write_urb->status == -EINPROGRESS) { - dbg ("%s - already writing", __FUNCTION__); - return (0); + spin_lock(&port->lock); + if (port->write_urb_busy) { + spin_unlock(&port->lock); + dbg("%s - already writing", __FUNCTION__); + return 0; } + port->write_urb_busy = 1; + spin_unlock(&port->lock); packet_length = port->bulk_out_size; // get max packetsize @@ -354,6 +358,7 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i #endif port->write_urb->dev = port->serial->dev; if ((result = usb_submit_urb (port->write_urb, GFP_KERNEL))) { + port->write_urb_busy = 0; err ("%s - failed submitting write urb, error %d", __FUNCTION__, result); return 0; } @@ -368,7 +373,7 @@ static int safe_write_room (struct usb_serial_port *port) dbg ("%s", __FUNCTION__); - if (port->write_urb->status != -EINPROGRESS) + if (port->write_urb_busy) room = port->bulk_out_size - (safe ? 2 : 0); if (room) { |
