]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
serial: stm32: add FIFO flush when port is closed
authorErwan Le Ray <erwan.leray@foss.st.com>
Thu, 4 Mar 2021 16:23:06 +0000 (17:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 08:49:36 +0000 (10:49 +0200)
commit5a172fd946bd9a7f9467fd6373e8b79c5132f5f3
tree8a60240ef47bbe15b3170cb2827e2a2f68c7a9e2
parentfdf94c73a7446ba2a94a6fcbc1e9e4d408d58ba5
serial: stm32: add FIFO flush when port is closed

[ Upstream commit 9f77d19207a0e8ba814c8ceb22e90ce7cb2aef64 ]

Transmission complete error is sent when ISR_TC is not set. If port closure
is requested despite data in TDR / TX FIFO has not been sent (because of
flow control), ISR_TC is not set and error message is sent on port closure
but also when a new port is opened.

Flush the data when port is closed, so the error isn't printed twice upon
next port opening.

Fixes: 64c32eab6603 ("serial: stm32: Add support of TC bit status check")
Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>
Link: https://lore.kernel.org/r/20210304162308.8984-12-erwan.leray@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/stm32-usart.c