aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-01-20 09:26:18 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-01-20 09:26:18 -0500
commit94c8b6dbd64c51aa7ce7fcc466beccf942271b0e (patch)
treeb9996ea3b85ff4afda1d52673390e22f4a1812b1
parente2651647080930a1846196c3b79f4de662100388 (diff)
serial: sh-sci: Bring oversized error handlers out of line.
Presently much of the error handling paths are inlined, stemming from a time when they were much smaller. This simply brings them out of line and leaves it up to the compiler. Given that some of these now contain nested loops, it's pretty hard to justify the inlining regardless of the footprint. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--drivers/serial/sh-sci.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index cf2c78079c0d..83bf1b8d7744 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -125,12 +125,6 @@ to_sci_port(struct uart_port *uart)
125#if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_SH_SCI_CONSOLE) 125#if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_SH_SCI_CONSOLE)
126 126
127#ifdef CONFIG_CONSOLE_POLL 127#ifdef CONFIG_CONSOLE_POLL
128static inline void handle_error(struct uart_port *port)
129{
130 /* Clear error flags */
131 sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port));
132}
133
134static int sci_poll_get_char(struct uart_port *port) 128static int sci_poll_get_char(struct uart_port *port)
135{ 129{
136 unsigned short status; 130 unsigned short status;
@@ -139,7 +133,7 @@ static int sci_poll_get_char(struct uart_port *port)
139 do { 133 do {
140 status = sci_in(port, SCxSR); 134 status = sci_in(port, SCxSR);
141 if (status & SCxSR_ERRORS(port)) { 135 if (status & SCxSR_ERRORS(port)) {
142 handle_error(port); 136 sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port));
143 continue; 137 continue;
144 } 138 }
145 break; 139 break;
@@ -458,7 +452,7 @@ static void sci_transmit_chars(struct uart_port *port)
458/* On SH3, SCIF may read end-of-break as a space->mark char */ 452/* On SH3, SCIF may read end-of-break as a space->mark char */
459#define STEPFN(c) ({int __c = (c); (((__c-1)|(__c)) == -1); }) 453#define STEPFN(c) ({int __c = (c); (((__c-1)|(__c)) == -1); })
460 454
461static inline void sci_receive_chars(struct uart_port *port) 455static void sci_receive_chars(struct uart_port *port)
462{ 456{
463 struct sci_port *sci_port = to_sci_port(port); 457 struct sci_port *sci_port = to_sci_port(port);
464 struct tty_struct *tty = port->state->port.tty; 458 struct tty_struct *tty = port->state->port.tty;
@@ -549,18 +543,21 @@ static inline void sci_receive_chars(struct uart_port *port)
549} 543}
550 544
551#define SCI_BREAK_JIFFIES (HZ/20) 545#define SCI_BREAK_JIFFIES (HZ/20)
552/* The sci generates interrupts during the break, 546
547/*
548 * The sci generates interrupts during the break,
553 * 1 per millisecond or so during the break period, for 9600 baud. 549 * 1 per millisecond or so during the break period, for 9600 baud.
554 * So dont bother disabling interrupts. 550 * So dont bother disabling interrupts.
555 * But dont want more than 1 break event. 551 * But dont want more than 1 break event.
556 * Use a kernel timer to periodically poll the rx line until 552 * Use a kernel timer to periodically poll the rx line until
557 * the break is finished. 553 * the break is finished.
558 */ 554 */
559static void sci_schedule_break_timer(struct sci_port *port) 555static inline void sci_schedule_break_timer(struct sci_port *port)
560{ 556{
561 port->break_timer.expires = jiffies + SCI_BREAK_JIFFIES; 557 port->break_timer.expires = jiffies + SCI_BREAK_JIFFIES;
562 add_timer(&port->break_timer); 558 add_timer(&port->break_timer);
563} 559}
560
564/* Ensure that two consecutive samples find the break over. */ 561/* Ensure that two consecutive samples find the break over. */
565static void sci_break_timer(unsigned long data) 562static void sci_break_timer(unsigned long data)
566{ 563{
@@ -577,7 +574,7 @@ static void sci_break_timer(unsigned long data)
577 port->break_flag = 0; 574 port->break_flag = 0;
578} 575}
579 576
580static inline int sci_handle_errors(struct uart_port *port) 577static int sci_handle_errors(struct uart_port *port)
581{ 578{
582 int copied = 0; 579 int copied = 0;
583 unsigned short status = sci_in(port, SCxSR); 580 unsigned short status = sci_in(port, SCxSR);
@@ -633,7 +630,7 @@ static inline int sci_handle_errors(struct uart_port *port)
633 return copied; 630 return copied;
634} 631}
635 632
636static inline int sci_handle_fifo_overrun(struct uart_port *port) 633static int sci_handle_fifo_overrun(struct uart_port *port)
637{ 634{
638 struct tty_struct *tty = port->state->port.tty; 635 struct tty_struct *tty = port->state->port.tty;
639 int copied = 0; 636 int copied = 0;
@@ -654,7 +651,7 @@ static inline int sci_handle_fifo_overrun(struct uart_port *port)
654 return copied; 651 return copied;
655} 652}
656 653
657static inline int sci_handle_breaks(struct uart_port *port) 654static int sci_handle_breaks(struct uart_port *port)
658{ 655{
659 int copied = 0; 656 int copied = 0;
660 unsigned short status = sci_in(port, SCxSR); 657 unsigned short status = sci_in(port, SCxSR);