]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
USB: serial: clean up generic write start busy test
authorJohan Hovold <jhovold@gmail.com>
Wed, 17 Mar 2010 22:06:02 +0000 (23:06 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 20 May 2010 20:21:34 +0000 (13:21 -0700)
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>
drivers/usb/serial/generic.c

index 63b43308e160a14f7c6a600f529cc7cfd252fc1e..9756b5c22d9460cf5a476f306fffdf31f56ef0b4 100644 (file)
@@ -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);