diff options
author | Jiri Slaby <jslaby@suse.cz> | 2022-05-03 10:08:08 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-05 22:42:47 +0200 |
commit | 240754894c30e3b13ca91113f177dd7f315eb297 (patch) | |
tree | 82fca93efbbc82e6a5f3844d7de483f2453f0b4f /drivers/tty | |
parent | serial: pch: simplify pop_tx() even more (diff) | |
download | linux-240754894c30e3b13ca91113f177dd7f315eb297.tar.xz linux-240754894c30e3b13ca91113f177dd7f315eb297.zip |
serial: pch: inline pop_tx() into handle_tx()
Given pop_tx() is a simple loop, inline it directly into handle_tx().
The code in handle_tx() looks much saner and straightforward now.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220503080808.28332-6-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/pch_uart.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index e1eadf519089..3b26524d48e3 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -757,23 +757,6 @@ static void pch_dma_tx_complete(void *arg) pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); } -static bool pop_tx(struct eg20t_port *priv, unsigned int size) -{ - struct uart_port *port = &priv->port; - struct circ_buf *xmit = &port->state->xmit; - bool ret = false; - - while (!uart_tx_stopped(port) && !uart_circ_empty(xmit) && size) { - iowrite8(xmit->buf[xmit->tail], priv->membase + PCH_UART_THR); - xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); - port->icount.tx++; - size--; - ret = true; - } - - return ret; -} - static int handle_rx_to(struct eg20t_port *priv) { struct pch_uart_buffer *buf; @@ -837,6 +820,7 @@ static int dma_handle_rx(struct eg20t_port *priv) static unsigned int handle_tx(struct eg20t_port *priv) { struct uart_port *port = &priv->port; + struct circ_buf *xmit = &port->state->xmit; int fifo_size; int tx_empty; @@ -858,8 +842,13 @@ static unsigned int handle_tx(struct eg20t_port *priv) fifo_size--; } - if (fifo_size && pop_tx(priv, fifo_size)) + while (!uart_tx_stopped(port) && !uart_circ_empty(xmit) && fifo_size) { + iowrite8(xmit->buf[xmit->tail], priv->membase + PCH_UART_THR); + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); + port->icount.tx++; + fifo_size--; tx_empty = 0; + } priv->tx_empty = tx_empty; |