summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2010-03-17 23:06:02 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 13:21:34 -0700
commit50a5f70cee11636908711abd339f5c5933375a7d (patch)
tree1145c5d38c20f9ad34df98f78b72fe0ce46314d8
parent1a1405e22563151de79fdc83aa5e5815d10f0291 (diff)
downloadop-kernel-dev-50a5f70cee11636908711abd339f5c5933375a7d.zip
op-kernel-dev-50a5f70cee11636908711abd339f5c5933375a7d.tar.gz
USB: serial: clean up generic write start busy test
Submit write urb if it is not already in use and we have buffered data. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/serial/generic.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 63b43308..9756b5c22 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -259,22 +259,15 @@ static int usb_serial_generic_write_start(struct usb_serial_port *port)
int result;
int count;
unsigned long flags;
- bool start_io;
- /* Atomically determine whether we can and need to start a USB
- * operation. */
spin_lock_irqsave(&port->lock, flags);
- if (port->write_urb_busy)
- start_io = false;
- else {
- start_io = (kfifo_len(&port->write_fifo) != 0);
- port->write_urb_busy = start_io;
+ if (port->write_urb_busy || !kfifo_len(&port->write_fifo)) {
+ spin_unlock_irqrestore(&port->lock, flags);
+ return 0;
}
+ port->write_urb_busy = 1;
spin_unlock_irqrestore(&port->lock, flags);
- if (!start_io)
- return 0;
-
data = port->write_urb->transfer_buffer;
count = kfifo_out_locked(&port->write_fifo, data, port->bulk_out_size, &port->lock);
usb_serial_debug_data(debug, &port->dev, __func__, count, data);
OpenPOWER on IntegriCloud