aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-04-18 11:33:21 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-19 13:24:13 -0400
commit2c992cd73772bd0ef107536e8e3399d28493caa8 (patch)
treef596c0810ab88d2c468140931e806bca40c3f067
parentb5784f7d8528926d69c5868f1ddb2af99f85e799 (diff)
USB: ti_usb_3410_5052: 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>
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 3ed8ecafe597..062b6d872ea3 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -687,6 +687,8 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
687 struct ti_port *tport = usb_get_serial_port_data(port); 687 struct ti_port *tport = usb_get_serial_port_data(port);
688 int chars = 0; 688 int chars = 0;
689 unsigned long flags; 689 unsigned long flags;
690 int ret;
691 u8 lsr;
690 692
691 if (tport == NULL) 693 if (tport == NULL)
692 return 0; 694 return 0;
@@ -695,6 +697,12 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
695 chars = kfifo_len(&tport->write_fifo); 697 chars = kfifo_len(&tport->write_fifo);
696 spin_unlock_irqrestore(&tport->tp_lock, flags); 698 spin_unlock_irqrestore(&tport->tp_lock, flags);
697 699
700 if (!chars) {
701 ret = ti_get_lsr(tport, &lsr);
702 if (!ret && !(lsr & TI_LSR_TX_EMPTY))
703 chars = 1;
704 }
705
698 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 706 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
699 return chars; 707 return chars;
700} 708}