Skip to content

Commit

Permalink
tty: serial: clean up stop-tx part in altera_uart_tx_chars()
Browse files Browse the repository at this point in the history
[ Upstream commit d9c1281 ]

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 <tklauser@distanz.ch>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220920052049.20507-3-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 1307c5d ("serial: altera_uart: fix locking in polling mode")
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Jiri Slaby authored and gregkh committed Dec 31, 2022
1 parent 6f7d823 commit b133b45
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/tty/serial/altera_uart.c
Expand Up @@ -272,10 +272,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)
Expand Down

0 comments on commit b133b45

Please sign in to comment.