diff options
author | Jeff Garzik <jgarzik@pretzel.yyz.us> | 2005-06-27 22:05:03 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-27 22:05:03 -0400 |
commit | 1bad3f4050b2a641bbfeaddb2717b28247311e9c (patch) | |
tree | bdc2efda40f48e0fbb64e6b9aca793e95ac72fc4 /drivers/usb/serial/ipw.c | |
parent | 747802ab478399f13ff57751c2ebd22577be4eeb (diff) | |
parent | c7b645f934e52a54af58142d91fb51f881f8ce26 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/usb/serial/ipw.c')
-rw-r--r-- | drivers/usb/serial/ipw.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index 11105d74f461..85e242459c27 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -399,16 +399,21 @@ static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int | |||
399 | dbg("%s - write request of 0 bytes", __FUNCTION__); | 399 | dbg("%s - write request of 0 bytes", __FUNCTION__); |
400 | return 0; | 400 | return 0; |
401 | } | 401 | } |
402 | 402 | ||
403 | /* Racy and broken, FIXME properly! */ | 403 | spin_lock(&port->lock); |
404 | if (port->write_urb->status == -EINPROGRESS) | 404 | if (port->write_urb_busy) { |
405 | spin_unlock(&port->lock); | ||
406 | dbg("%s - already writing", __FUNCTION__); | ||
405 | return 0; | 407 | return 0; |
408 | } | ||
409 | port->write_urb_busy = 1; | ||
410 | spin_unlock(&port->lock); | ||
406 | 411 | ||
407 | count = min(count, port->bulk_out_size); | 412 | count = min(count, port->bulk_out_size); |
408 | memcpy(port->bulk_out_buffer, buf, count); | 413 | memcpy(port->bulk_out_buffer, buf, count); |
409 | 414 | ||
410 | dbg("%s count now:%d", __FUNCTION__, count); | 415 | dbg("%s count now:%d", __FUNCTION__, count); |
411 | 416 | ||
412 | usb_fill_bulk_urb(port->write_urb, dev, | 417 | usb_fill_bulk_urb(port->write_urb, dev, |
413 | usb_sndbulkpipe(dev, port->bulk_out_endpointAddress), | 418 | usb_sndbulkpipe(dev, port->bulk_out_endpointAddress), |
414 | port->write_urb->transfer_buffer, | 419 | port->write_urb->transfer_buffer, |
@@ -418,6 +423,7 @@ static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int | |||
418 | 423 | ||
419 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 424 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
420 | if (ret != 0) { | 425 | if (ret != 0) { |
426 | port->write_urb_busy = 0; | ||
421 | dbg("%s - usb_submit_urb(write bulk) failed with error = %d", __FUNCTION__, ret); | 427 | dbg("%s - usb_submit_urb(write bulk) failed with error = %d", __FUNCTION__, ret); |
422 | return ret; | 428 | return ret; |
423 | } | 429 | } |