summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_ti.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-01-14 16:52:57 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-19 00:45:17 +0100
commit263e1f9fbb999fb78df5bfed87ddbba1c12ee0f1 (patch)
tree07eccb56a78f378488625a69c7957b75e01e2f79 /drivers/usb/serial/io_ti.c
parentUSB: serial: grab disconnect mutex in chars_in_buffer (diff)
downloadlinux-263e1f9fbb999fb78df5bfed87ddbba1c12ee0f1.tar.xz
linux-263e1f9fbb999fb78df5bfed87ddbba1c12ee0f1.zip
USB: io_ti: query hardware-buffer status in chars_in_buffer
Query hardware-buffer status in chars_in_buffer should the write fifo be empty. This is needed to make the tty layer wait for hardware buffers to drain on close. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r--drivers/usb/serial/io_ti.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 3abbdaad838d..590f27d3bfc1 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2088,6 +2088,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
int chars = 0;
unsigned long flags;
+ int ret;
if (edge_port == NULL)
return 0;
@@ -2098,6 +2099,12 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
chars = kfifo_len(&edge_port->write_fifo);
spin_unlock_irqrestore(&edge_port->ep_lock, flags);
+ if (!chars) {
+ ret = tx_active(edge_port);
+ if (ret > 0)
+ chars = ret;
+ }
+
dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
return chars;
}