Commit 2a9604b8 authored by Russell King's avatar Russell King

[PATCH] Serial: Move error path processing inline

With unlikely() there's no need for the error path to
use gotos.
Signed-off-by: default avatarRussell King <rmk@arm.linux.org.uk>
parent 45849282
...@@ -116,22 +116,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re ...@@ -116,22 +116,7 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re
* Note that the error handling code is * Note that the error handling code is
* out of the main execution path * out of the main execution path
*/ */
if (unlikely(ch & UART_ANY_ERR)) if (unlikely(ch & UART_ANY_ERR)) {
goto handle_error;
if (uart_handle_sysrq_char(port, ch, regs))
goto ignore_char;
error_return:
tty_insert_flip_char(tty, ch, flg);
ignore_char:
status = clps_readl(SYSFLG(port));
}
out:
tty_flip_buffer_push(tty);
return IRQ_HANDLED;
handle_error:
if (ch & UARTDR_PARERR) if (ch & UARTDR_PARERR)
port->icount.parity++; port->icount.parity++;
else if (ch & UARTDR_FRMERR) else if (ch & UARTDR_FRMERR)
...@@ -139,11 +124,6 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re ...@@ -139,11 +124,6 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re
if (ch & UARTDR_OVERR) if (ch & UARTDR_OVERR)
port->icount.overrun++; port->icount.overrun++;
if (ch & port->ignore_status_mask) {
if (++ignored > 100)
goto out;
goto ignore_char;
}
ch &= port->read_status_mask; ch &= port->read_status_mask;
if (ch & UARTDR_PARERR) if (ch & UARTDR_PARERR)
...@@ -151,19 +131,28 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re ...@@ -151,19 +131,28 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re
else if (ch & UARTDR_FRMERR) else if (ch & UARTDR_FRMERR)
flg = TTY_FRAME; flg = TTY_FRAME;
if (ch & UARTDR_OVERR) { #ifdef SUPPORT_SYSRQ
port->sysrq = 0;
#endif
}
if (uart_handle_sysrq_char(port, ch, regs))
goto ignore_char;
/* /*
* CHECK: does overrun affect the current character? * CHECK: does overrun affect the current character?
* ASSUMPTION: it does not. * ASSUMPTION: it does not.
*/ */
if ((ch & port->ignore_status_mask & ~RXSTAT_OVERRUN) == 0)
tty_insert_flip_char(tty, ch, flg); tty_insert_flip_char(tty, ch, flg);
ch = 0; if ((ch & ~port->ignore_status_mask & RXSTAT_OVERRUN) == 0)
flg = TTY_OVERRUN; tty_insert_flip_char(tty, 0, TTY_OVERRUN);
ignore_char:
status = clps_readl(SYSFLG(port));
} }
#ifdef SUPPORT_SYSRQ tty_flip_buffer_push(tty);
port->sysrq = 0; return IRQ_HANDLED;
#endif
goto error_return;
} }
static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs)
......
...@@ -214,23 +214,7 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs) ...@@ -214,23 +214,7 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs)
* note that the error handling code is * note that the error handling code is
* out of the main execution path * out of the main execution path
*/ */
if (status & UTSR1_TO_SM(UTSR1_PRE | UTSR1_FRE | UTSR1_ROR)) if (status & UTSR1_TO_SM(UTSR1_PRE | UTSR1_FRE | UTSR1_ROR)) {
goto handle_error;
if (uart_handle_sysrq_char(&sport->port, ch, regs))
goto ignore_char;
error_return:
tty_insert_flip_char(tty, ch, flg);
ignore_char:
status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
UTSR0_TO_SM(UART_GET_UTSR0(sport));
}
out:
tty_flip_buffer_push(tty);
return;
handle_error:
if (status & UTSR1_TO_SM(UTSR1_PRE)) if (status & UTSR1_TO_SM(UTSR1_PRE))
sport->port.icount.parity++; sport->port.icount.parity++;
else if (status & UTSR1_TO_SM(UTSR1_FRE)) else if (status & UTSR1_TO_SM(UTSR1_FRE))
...@@ -238,12 +222,6 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs) ...@@ -238,12 +222,6 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs)
if (status & UTSR1_TO_SM(UTSR1_ROR)) if (status & UTSR1_TO_SM(UTSR1_ROR))
sport->port.icount.overrun++; sport->port.icount.overrun++;
if (status & sport->port.ignore_status_mask) {
if (++ignored > 100)
goto out;
goto ignore_char;
}
status &= sport->port.read_status_mask; status &= sport->port.read_status_mask;
if (status & UTSR1_TO_SM(UTSR1_PRE)) if (status & UTSR1_TO_SM(UTSR1_PRE))
...@@ -251,19 +229,24 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs) ...@@ -251,19 +229,24 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs)
else if (status & UTSR1_TO_SM(UTSR1_FRE)) else if (status & UTSR1_TO_SM(UTSR1_FRE))
flg = TTY_FRAME; flg = TTY_FRAME;
if (status & UTSR1_TO_SM(UTSR1_ROR)) {
/*
* overrun does *not* affect the character
* we read from the FIFO
*/
tty_insert_flip_char(tty, ch, flg);
ch = 0;
flg = TTY_OVERRUN;
}
#ifdef SUPPORT_SYSRQ #ifdef SUPPORT_SYSRQ
sport->port.sysrq = 0; sport->port.sysrq = 0;
#endif #endif
goto error_return; }
if (uart_handle_sysrq_char(&sport->port, ch, regs))
goto ignore_char;
if ((status & port->ignore_status_mask & ~UTSR1_TO_SM(UTSR1_ROR)) == 0)
tty_insert_flip_char(tty, ch, flg);
if (status & ~port->ignore_status_mask & UTSR1_TO_SM(UTSR1_ROR))
tty_insert_flip_char(tty, 0, TTY_OVERRUN);
ignore_char:
status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
UTSR0_TO_SM(UART_GET_UTSR0(sport));
}
tty_flip_buffer_push(tty);
} }
static void sa1100_tx_chars(struct sa1100_port *sport) static void sa1100_tx_chars(struct sa1100_port *sport)
......
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