serial: sh-sci: Codestyle cleanup patch.

Trivial coding style cleanups.

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
Michael Trimarchi 2008-11-13 18:18:35 +09:00 committed by Paul Mundt
parent af505b1eab
commit e7c98dc76d
1 changed files with 74 additions and 56 deletions

View File

@ -101,6 +101,12 @@ static void sci_stop_tx(struct uart_port *port);
static struct sci_port sci_ports[SCI_NPORTS];
static struct uart_driver sci_uart_driver;
static inline struct sci_port *
to_sci_port(struct uart_port *uart)
{
return container_of(uart, struct sci_port, port);
}
#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && \
defined(CONFIG_SH_STANDARD_BIOS) || defined(CONFIG_SH_KGDB)
static inline void handle_error(struct uart_port *port)
@ -124,7 +130,8 @@ static int get_char(struct uart_port *port)
}
} while (!(status & SCxSR_RDxF(port)));
c = sci_in(port, SCxRDR);
sci_in(port, SCxSR); /* Dummy read */
/* Dummy read */
sci_in(port, SCxSR);
sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port));
spin_unlock_irqrestore(&port->lock, flags);
@ -181,7 +188,8 @@ static void put_string(struct sci_port *sci_port, const char *buffer, int count)
put_char(port, 'O'); /* 'O'utput to console */
checksum = 'O';
for (i=0; i<count; i++) { /* Don't use run length encoding */
/* Don't use run length encoding */
for (i = 0; i < count; i++) {
int h, l;
c = *p++;
@ -232,12 +240,11 @@ static void h8300_sci_config(struct uart_port* port, unsigned int ctrl)
int ch = (port->mapbase - SMR0) >> 3;
unsigned char mask = 1 << (ch+1);
if (ctrl == sci_disable) {
if (ctrl == sci_disable)
*mstpcrl |= mask;
} else {
else
*mstpcrl &= ~mask;
}
}
static inline void h8300_sci_enable(struct uart_port *port)
{
@ -290,9 +297,8 @@ static void sci_init_pins_scif(struct uart_port* port, unsigned int cflag)
unsigned int fcr_val = 0;
set_sh771x_scif_pfc(port);
if (cflag & CRTSCTS) {
if (cflag & CRTSCTS)
fcr_val |= SCFCR_MCE;
}
sci_out(port, SCFCR, fcr_val);
}
#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || defined(CONFIG_CPU_SUBTYPE_SH7721)
@ -419,19 +425,27 @@ static inline int scif_rxroom(struct uart_port *port)
#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
static inline int scif_txroom(struct uart_port *port)
{
if((port->mapbase == 0xffe00000) || (port->mapbase == 0xffe08000)) /* SCIF0/1*/
if ((port->mapbase == 0xffe00000) ||
(port->mapbase == 0xffe08000)) {
/* SCIF0/1*/
return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0xff);
else /* SCIF2 */
} else {
/* SCIF2 */
return SCIF2_TXROOM_MAX - (sci_in(port, SCFDR) >> 8);
}
}
static inline int scif_rxroom(struct uart_port *port)
{
if((port->mapbase == 0xffe00000) || (port->mapbase == 0xffe08000)) /* SCIF0/1*/
if ((port->mapbase == 0xffe00000) ||
(port->mapbase == 0xffe08000)) {
/* SCIF0/1*/
return sci_in(port, SCRFDR) & 0xff;
else /* SCIF2 */
} else {
/* SCIF2 */
return sci_in(port, SCFDR) & SCIF2_RFDC_MASK;
}
}
#else
static inline int scif_txroom(struct uart_port *port)
{
@ -446,12 +460,12 @@ static inline int scif_rxroom(struct uart_port *port)
static inline int sci_txroom(struct uart_port *port)
{
return ((sci_in(port, SCxSR) & SCI_TDRE) != 0);
return (sci_in(port, SCxSR) & SCI_TDRE) != 0;
}
static inline int sci_rxroom(struct uart_port *port)
{
return ((sci_in(port, SCxSR) & SCxSR_RDxF(port)) != 0);
return (sci_in(port, SCxSR) & SCxSR_RDxF(port)) != 0;
}
/* ********************************************************************** *
@ -469,11 +483,10 @@ static void sci_transmit_chars(struct uart_port *port)
status = sci_in(port, SCxSR);
if (!(status & SCxSR_TDxE(port))) {
ctrl = sci_in(port, SCSCR);
if (uart_circ_empty(xmit)) {
if (uart_circ_empty(xmit))
ctrl &= ~SCI_CTRL_FLAGS_TIE;
} else {
else
ctrl |= SCI_CTRL_FLAGS_TIE;
}
sci_out(port, SCSCR, ctrl);
return;
}
@ -525,7 +538,7 @@ static void sci_transmit_chars(struct uart_port *port)
static inline void sci_receive_chars(struct uart_port *port)
{
struct sci_port *sci_port = (struct sci_port *)port;
struct sci_port *sci_port = to_sci_port(port);
struct tty_struct *tty = port->info->port.tty;
int i, count, copied = 0;
unsigned short status;
@ -550,11 +563,11 @@ static inline void sci_receive_chars(struct uart_port *port)
if (port->type == PORT_SCI) {
char c = sci_in(port, SCxRDR);
if (uart_handle_sysrq_char(port, c) || sci_port->break_flag)
if (uart_handle_sysrq_char(port, c) ||
sci_port->break_flag)
count = 0;
else {
else
tty_insert_flip_char(tty, c, TTY_NORMAL);
}
} else {
for (i = 0; i < count; i++) {
char c = sci_in(port, SCxRDR);
@ -657,7 +670,7 @@ static inline int sci_handle_errors(struct uart_port *port)
if (status & SCxSR_FER(port)) {
if (sci_rxd_in(port) == 0) {
/* Notify of BREAK */
struct sci_port *sci_port = (struct sci_port *)port;
struct sci_port *sci_port = to_sci_port(port);
if (!sci_port->break_flag) {
sci_port->break_flag = 1;
@ -670,6 +683,7 @@ static inline int sci_handle_errors(struct uart_port *port)
if (tty_insert_flip_char(tty, 0, TTY_BREAK))
copied++;
}
} else {
/* frame error */
if (tty_insert_flip_char(tty, 0, TTY_FRAME))
@ -906,7 +920,7 @@ static void sci_free_irq(struct sci_port *port)
if (port->irqs[0] == port->irqs[1]) {
if (!port->irqs[0])
printk("sci: sci_free_irq error\n");
printk(KERN_ERR "sci: sci_free_irq error\n");
else
free_irq(port->irqs[0], port);
} else {
@ -1063,9 +1077,9 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
if (t >= 256) {
sci_out(port, SCSMR, (sci_in(port, SCSMR) & ~3) | 1);
t >>= 2;
} else {
} else
sci_out(port, SCSMR, sci_in(port, SCSMR) & ~3);
}
sci_out(port, SCBRR, t);
udelay((1000000+(baud-1)) / baud); /* Wait one bit interval */
}
@ -1082,10 +1096,14 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
static const char *sci_type(struct uart_port *port)
{
switch (port->type) {
case PORT_SCI: return "sci";
case PORT_SCIF: return "scif";
case PORT_IRDA: return "irda";
case PORT_SCIFA: return "scifa";
case PORT_IRDA:
return "irda";
case PORT_SCI:
return "sci";
case PORT_SCIF:
return "scif";
case PORT_SCIFA:
return "scifa";
}
return NULL;
@ -1387,9 +1405,9 @@ console_initcall(kgdb_console_init);
#endif /* CONFIG_SH_KGDB_CONSOLE */
#if defined(CONFIG_SH_KGDB_CONSOLE)
#define SCI_CONSOLE &kgdb_console
#define SCI_CONSOLE (&kgdb_console)
#elif defined(CONFIG_SERIAL_SH_SCI_CONSOLE)
#define SCI_CONSOLE &serial_console
#define SCI_CONSOLE (&serial_console)
#else
#define SCI_CONSOLE 0
#endif