tty: serial: clean up stop-tx part in altera_uart_tx_chars()

[ Upstream commit d9c128117da41cf4cb0e80ae565b5d3ac79dffac ]

The "stop TX" path in altera_uart_tx_chars() is open-coded, so:
* use uart_circ_empty() to check if the buffer is empty, and
* when true, call altera_uart_stop_tx().

Cc: Tobias Klauser <[email protected]>
Reviewed-by: Ilpo Järvinen <[email protected]>
Acked-by: Tobias Klauser <[email protected]>
Signed-off-by: Jiri Slaby <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Stable-dep-of: 1307c5d33cce ("serial: altera_uart: fix locking in polling mode")
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
Jiri Slaby 2022-09-20 07:20:42 +02:00 • committed by Greg Kroah-Hartman
commit 071bb9e363

View file

@ -274,10 +274,8 @@ static void altera_uart_tx_chars(struct altera_uart *pp)
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(port);
if (xmit->head == xmit->tail) {
pp->imr &= ~ALTERA_UART_CONTROL_TRDY_MSK;
altera_uart_update_ctrl_reg(pp);
}
if (uart_circ_empty(xmit))
altera_uart_stop_tx(port);
}
static irqreturn_t altera_uart_interrupt(int irq, void *data)