Skip to content

Commit 263e1f9

Browse files
jhovoldgregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 810360a commit 263e1f9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/usb/serial/io_ti.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,6 +2088,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
20882088
struct edgeport_port *edge_port = usb_get_serial_port_data(port);
20892089
int chars = 0;
20902090
unsigned long flags;
2091+
int ret;
20912092

20922093
if (edge_port == NULL)
20932094
return 0;
@@ -2098,6 +2099,12 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
20982099
chars = kfifo_len(&edge_port->write_fifo);
20992100
spin_unlock_irqrestore(&edge_port->ep_lock, flags);
21002101

2102+
if (!chars) {
2103+
ret = tx_active(edge_port);
2104+
if (ret > 0)
2105+
chars = ret;
2106+
}
2107+
21012108
dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
21022109
return chars;
21032110
}

0 commit comments

Comments
 (0)