mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
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>
This commit is contained in:
parent
810360a035
commit
263e1f9fbb
1 changed files with 7 additions and 0 deletions
|
@ -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);
|
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
|
||||||
int chars = 0;
|
int chars = 0;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (edge_port == NULL)
|
if (edge_port == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2098,6 +2099,12 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
|
||||||
chars = kfifo_len(&edge_port->write_fifo);
|
chars = kfifo_len(&edge_port->write_fifo);
|
||||||
spin_unlock_irqrestore(&edge_port->ep_lock, flags);
|
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);
|
dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
|
||||||
return chars;
|
return chars;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue