diff options
| author | Sascha Hauer <[email protected]> | 2008-04-17 07:39:22 +0000 |
|---|---|---|
| committer | Russell King <[email protected]> | 2008-04-17 15:18:19 +0000 |
| commit | 864eeed051b527c8081e2f85b51ba24823acaf71 (patch) | |
| tree | 7fa05275be02d98f5956b3030cdbf3c2a5f18228 | |
| parent | [ARM] 4993/1: <IMX UART>: Trivial: Remove unused defines (diff) | |
| download | kernel-864eeed051b527c8081e2f85b51ba24823acaf71.tar.gz kernel-864eeed051b527c8081e2f85b51ba24823acaf71.zip | |
[ARM] 4994/1: <IMX UART>: Move error handling into execution path
Move the error handling code for erroneous receive characters into
execution path. This makes the code more readable and the compiler
should know how to optimize this, right?
Signed-off-by: Sascha Hauer <[email protected]>
Signed-off-by: Russell King <[email protected]>
| -rw-r--r-- | drivers/serial/imx.c | 74 |
1 files changed, 33 insertions, 41 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 06fa54c53fdc..c637ae219126 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c @@ -354,66 +354,58 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) struct tty_struct *tty = sport->port.info->tty; unsigned long flags, temp; - rx = readl(sport->port.membase + URXD0); spin_lock_irqsave(&sport->port.lock,flags); - do { + while ((rx = readl(sport->port.membase + URXD0)) & URXD_CHARRDY) { flg = TTY_NORMAL; sport->port.icount.rx++; temp = readl(sport->port.membase + USR2); - if( temp & USR2_BRCD ) { + if (temp & USR2_BRCD) { writel(temp | USR2_BRCD, sport->port.membase + USR2); - if(uart_handle_break(&sport->port)) - goto ignore_char; + if (uart_handle_break(&sport->port)) + continue; } if (uart_handle_sysrq_char (&sport->port, (unsigned char)rx)) - goto ignore_char; + continue; - if( rx & (URXD_PRERR | URXD_OVRRUN | URXD_FRMERR) ) - goto handle_error; + if (rx & (URXD_PRERR | URXD_OVRRUN | URXD_FRMERR) ) { + if (rx & URXD_PRERR) + sport->port.icount.parity++; + else if (rx & URXD_FRMERR) + sport->port.icount.frame++; + if (rx & URXD_OVRRUN) + sport->port.icount.overrun++; - error_return: - tty_insert_flip_char(tty, rx, flg); + if (rx & sport->port.ignore_status_mask) { + if (++ignored > 100) + goto out; + continue; + } - ignore_char: - rx = readl(sport->port.membase + URXD0); - } while(rx & URXD_CHARRDY); + rx &= sport->port.read_status_mask; -out: - spin_unlock_irqrestore(&sport->port.lock,flags); - tty_flip_buffer_push(tty); - return IRQ_HANDLED; + if (rx & URXD_PRERR) + flg = TTY_PARITY; + else if (rx & URXD_FRMERR) + flg = TTY_FRAME; + if (rx & URXD_OVRRUN) + flg = TTY_OVERRUN; -handle_error: - if (rx & URXD_PRERR) - sport->port.icount.parity++; - else if (rx & URXD_FRMERR) - sport->port.icount.frame++; - if (rx & URXD_OVRRUN) - sport->port.icount.overrun++; +#ifdef SUPPORT_SYSRQ + sport->port.sysrq = 0; +#endif + } - if (rx & sport->port.ignore_status_mask) { - if (++ignored > 100) - goto out; - goto ignore_char; + tty_insert_flip_char(tty, rx, flg); } - rx &= sport->port.read_status_mask; - - if (rx & URXD_PRERR) - flg = TTY_PARITY; - else if (rx & URXD_FRMERR) - flg = TTY_FRAME; - if (rx & URXD_OVRRUN) - flg = TTY_OVERRUN; - -#ifdef SUPPORT_SYSRQ - sport->port.sysrq = 0; -#endif - goto error_return; +out: + spin_unlock_irqrestore(&sport->port.lock,flags); + tty_flip_buffer_push(tty); + return IRQ_HANDLED; } /* |
