aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2022-04-21 12:17:04 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-22 16:21:53 +0200
commit08814cd69d4eace3612aaa386dffa5ebb8d1e1a4 (patch)
tree40fe46056a49975d06095526b2cb8210f90d4ae1
parentserial: xilinx_uartps: return early in cdns_uart_handle_tx() (diff)
downloadlinux-dev-08814cd69d4eace3612aaa386dffa5ebb8d1e1a4.tar.xz
linux-dev-08814cd69d4eace3612aaa386dffa5ebb8d1e1a4.zip
serial: xilinx_uartps: cache xmit in cdns_uart_handle_tx()
Cache port->state->xmit into a local variable (xmit) in cdns_uart_handle_tx(). This reduces length of some lines there significantly. I.e. makes the code more readable. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20220421101708.5640-4-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/xilinx_uartps.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index b84ae9c07c3b..9e01fe6c0ab8 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -313,29 +313,26 @@ static void cdns_uart_handle_rx(void *dev_id, unsigned int isrstatus)
static void cdns_uart_handle_tx(void *dev_id)
{
struct uart_port *port = (struct uart_port *)dev_id;
+ struct circ_buf *xmit = &port->state->xmit;
unsigned int numbytes;
- if (uart_circ_empty(&port->state->xmit)) {
+ if (uart_circ_empty(xmit)) {
writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IDR);
return;
}
numbytes = port->fifosize;
- while (numbytes && !uart_circ_empty(&port->state->xmit) &&
- !(readl(port->membase + CDNS_UART_SR) &
- CDNS_UART_SR_TXFULL)) {
+ while (numbytes && !uart_circ_empty(xmit) &&
+ !(readl(port->membase + CDNS_UART_SR) & CDNS_UART_SR_TXFULL)) {
- writel(port->state->xmit.buf[port->state->xmit.tail],
- port->membase + CDNS_UART_FIFO);
+ writel(xmit->buf[xmit->tail], port->membase + CDNS_UART_FIFO);
port->icount.tx++;
- port->state->xmit.tail = (port->state->xmit.tail + 1) &
- (UART_XMIT_SIZE - 1);
-
+ xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
numbytes--;
}
- if (uart_circ_chars_pending(&port->state->xmit) < WAKEUP_CHARS)
+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(port);
}