Commit e73be92d authored by Lukas Wunner's avatar Lukas Wunner Committed by Greg Kroah-Hartman

serial: pl011: Drop duplicate loop counter

pl011_fifo_to_tty() has two counters (max_count and fifotaken) for the
same loop.  One counter should suffice.  This saves one subtraction per
character read from the RX FIFO.

Cc: Mathias Duckeck <m.duckeck@kunbus.de>
Cc: Phil Elwell <phil@raspberrypi.org>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f859722a
...@@ -314,10 +314,9 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap, ...@@ -314,10 +314,9 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
static int pl011_fifo_to_tty(struct uart_amba_port *uap) static int pl011_fifo_to_tty(struct uart_amba_port *uap)
{ {
u16 status; u16 status;
unsigned int ch, flag, max_count = 256; unsigned int ch, flag, fifotaken;
int fifotaken = 0;
while (max_count--) { for (fifotaken = 0; fifotaken != 256; fifotaken++) {
status = pl011_read(uap, REG_FR); status = pl011_read(uap, REG_FR);
if (status & UART01x_FR_RXFE) if (status & UART01x_FR_RXFE)
break; break;
...@@ -326,7 +325,6 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap) ...@@ -326,7 +325,6 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap)
ch = pl011_read(uap, REG_DR) | UART_DUMMY_DR_RX; ch = pl011_read(uap, REG_DR) | UART_DUMMY_DR_RX;
flag = TTY_NORMAL; flag = TTY_NORMAL;
uap->port.icount.rx++; uap->port.icount.rx++;
fifotaken++;
if (unlikely(ch & UART_DR_ERROR)) { if (unlikely(ch & UART_DR_ERROR)) {
if (ch & UART011_DR_BE) { if (ch & UART011_DR_BE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment