]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
serial: core: only stop transmit when HW fifo is empty
authorJonas Gorski <jonas.gorski@gmail.com>
Sun, 3 Mar 2024 15:08:07 +0000 (16:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:28:25 +0000 (15:28 +0200)
commit6f12c54fa09dfd4022db1c627da42cacab2e7a24
treecdf61c693798b0232d138905f93707bf3cd2b926
parent1846bd4fc1bbddb748bb1dbacc81861a2a8f8bd0
serial: core: only stop transmit when HW fifo is empty

[ Upstream commit 7bfb915a597a301abb892f620fe5c283a9fdbd77 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/serial_core.h