Skip to content

Commit

Permalink
tty: serial: uartlite: Use constants in early_uartlite_putc
Browse files Browse the repository at this point in the history
Use the constants defined at the beginning of this file instead of
integer literals when accessing registers. This makes this code easier
to read, and obviates the need for some explanatory comments.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Link: https://lore.kernel.org/r/20210826194323.3209227-1-sean.anderson@seco.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Sean Anderson authored and Greg Kroah-Hartman committed Aug 27, 2021
1 parent bb2853a commit 3620a89
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/tty/serial/uartlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,16 +561,15 @@ static void early_uartlite_putc(struct uart_port *port, int c)
* This limit is pretty arbitrary, unless we are at about 10 baud
* we'll never timeout on a working UART.
*/

unsigned retries = 1000000;
/* read status bit - 0x8 offset */
while (--retries && (readl(port->membase + 8) & (1 << 3)))

while (--retries &&
(readl(port->membase + ULITE_STATUS) & ULITE_STATUS_TXFULL))
;

/* Only attempt the iowrite if we didn't timeout */
/* write to TX_FIFO - 0x4 offset */
if (retries)
writel(c & 0xff, port->membase + 4);
writel(c & 0xff, port->membase + ULITE_TX);
}

static void early_uartlite_write(struct console *console,
Expand Down

0 comments on commit 3620a89

Please sign in to comment.