Skip to content

Commit

Permalink
8250_tegra: clean up tegra_uart_handle_break
Browse files Browse the repository at this point in the history
* switch "do { A; } while (1)" to "while (1) { A; }"
* switch "if (A) B; else break;" to "if (!A) break; B;"
* remove unused assignment from p->serial_in() to status

Objdump -d shows no difference.

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210105120239.28031-6-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Jan 7, 2021
1 parent 9bc1b2b commit 7d7dec4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/tty/serial/8250/8250_tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ static void tegra_uart_handle_break(struct uart_port *p)
{
unsigned int status, tmout = 10000;

do {
while (1) {
status = p->serial_in(p, UART_LSR);
if (status & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS))
status = p->serial_in(p, UART_RX);
else
if (!(status & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS)))
break;

p->serial_in(p, UART_RX);

if (--tmout == 0)
break;
udelay(1);
} while (1);
}
}

static int tegra_uart_probe(struct platform_device *pdev)
Expand Down

0 comments on commit 7d7dec4

Please sign in to comment.