Skip to content

Commit

Permalink
serial: stm32: fix transmit_chars when tx is stopped
Browse files Browse the repository at this point in the history
[ Upstream commit b83b957c91f68e53f0dc596e129e8305761f2a32 ]

Disables the tx irq  when the transmission is ended and updates stop_tx
conditions for code cleanup.

Fixes: 48a6092 ("serial: stm32-usart: Add STM32 USART Driver")
Signed-off-by: Erwan Le Ray <erwan.leray@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Erwan Le Ray authored and Coconutat committed Dec 2, 2023
1 parent 23ed60b commit 3358d48
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/tty/serial/stm32-usart.c
Expand Up @@ -293,13 +293,8 @@ static void stm32_transmit_chars(struct uart_port *port)
return;
}

if (uart_tx_stopped(port)) {
stm32_stop_tx(port);
return;
}

if (uart_circ_empty(xmit)) {
stm32_stop_tx(port);
if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
stm32_clr_bits(port, ofs->cr1, USART_CR1_TXEIE);
return;
}

Expand All @@ -312,7 +307,7 @@ static void stm32_transmit_chars(struct uart_port *port)
uart_write_wakeup(port);

if (uart_circ_empty(xmit))
stm32_stop_tx(port);
stm32_clr_bits(port, ofs->cr1, USART_CR1_TXEIE);
}

static irqreturn_t stm32_interrupt(int irq, void *ptr)
Expand Down

0 comments on commit 3358d48

Please sign in to comment.