serial: core: only stop transmit when HW fifo is empty
If the circular buffer is empty, it just means we fit all characters to
send into the HW fifo, but not that the hardware finished transmitting
them.
So if we immediately call stop_tx() after that, this may abort any
pending characters in the HW fifo, and cause dropped characters on the
console.
Fix this by only stopping tx when the tx HW fifo is actually empty.
Fixes: 8275b48b27
("tty: serial: introduce transmit helpers")
Cc: stable@vger.kernel.org
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://lore.kernel.org/r/20240303150807.68117-1-jonas.gorski@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d47dd323bf
commit
7bfb915a59
1 changed files with 2 additions and 1 deletions
|
@ -786,7 +786,8 @@ enum UART_TX_FLAGS {
|
||||||
if (pending < WAKEUP_CHARS) { \
|
if (pending < WAKEUP_CHARS) { \
|
||||||
uart_write_wakeup(__port); \
|
uart_write_wakeup(__port); \
|
||||||
\
|
\
|
||||||
if (!((flags) & UART_TX_NOSTOP) && pending == 0) \
|
if (!((flags) & UART_TX_NOSTOP) && pending == 0 && \
|
||||||
|
__port->ops->tx_empty(__port)) \
|
||||||
__port->ops->stop_tx(__port); \
|
__port->ops->stop_tx(__port); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
|
Loading…
Add table
Reference in a new issue