summaryrefslogtreecommitdiffstats
path: root/include/linux/serial_core.h
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2024-03-03 16:08:07 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-05 13:37:29 +0000
commit7bfb915a597a301abb892f620fe5c283a9fdbd77 (patch)
treeea89f5a9ee6ac60d18ff4cfe62c6cfbf0c371e0d /include/linux/serial_core.h
parentd47dd323bf959dbf5f3e7f83373c8ed5f3bec9c0 (diff)
downloadlinux-7bfb915a597a301abb892f620fe5c283a9fdbd77.tar.gz
linux-7bfb915a597a301abb892f620fe5c283a9fdbd77.tar.bz2
linux-7bfb915a597a301abb892f620fe5c283a9fdbd77.zip
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: 8275b48b2780 ("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>
Diffstat (limited to 'include/linux/serial_core.h')
-rw-r--r--include/linux/serial_core.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 55b1f3ba48ac..bb0f2d4ac62f 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -786,7 +786,8 @@ enum UART_TX_FLAGS {
if (pending < WAKEUP_CHARS) { \
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); \
} \
\