Skip to content

Commit

Permalink
USB: serial: clean up chars_in_buffer
Browse files Browse the repository at this point in the history
No need to grab disconnect mutex in chars_in_buffer now that no
sub-driver is or should be querying hardware buffers anymore. (They
should use wait_until_sent.)

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed May 17, 2013
1 parent ff93b19 commit 4746b6c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,20 +359,13 @@ static int serial_chars_in_buffer(struct tty_struct *tty)
{
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = port->serial;
int count = 0;

dev_dbg(tty->dev, "%s\n", __func__);

mutex_lock(&serial->disc_mutex);
/* if the device was unplugged then any remaining characters
fell out of the connector ;) */
if (serial->disconnected)
count = 0;
else
count = serial->type->chars_in_buffer(tty);
mutex_unlock(&serial->disc_mutex);
return 0;

return count;
return serial->type->chars_in_buffer(tty);
}

static void serial_wait_until_sent(struct tty_struct *tty, int timeout)
Expand Down

0 comments on commit 4746b6c

Please sign in to comment.