diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c index 2b5f6a653d9a34..70f764d814bd73 100644 --- a/drivers/tty/serial/apbuart.c +++ b/drivers/tty/serial/apbuart.c @@ -6,9 +6,11 @@ * * Copyright (C) 2000 Deep Blue Solutions Ltd. * Copyright (C) 2003 Konrad Eisele - * Copyright (C) 2006 Daniel Hellstrom , Aeroflex Gaisler AB + * Copyright (C) 2006 Daniel Hellstrom , + * Aeroflex Gaisler AB * Copyright (C) 2008 Gilead Kutnick - * Copyright (C) 2009 Kristoffer Glembo , Aeroflex Gaisler AB + * Copyright (C) 2009 Kristoffer Glembo , + * Aeroflex Gaisler AB */ #include @@ -112,8 +114,7 @@ static void apbuart_rx_chars(struct uart_port *port) uart_insert_char(port, rsr, UART_STATUS_OE, ch, flag); - - ignore_char: +ignore_char: status = UART_GET_STATUS(port); } @@ -177,6 +178,7 @@ static irqreturn_t apbuart_int(int irq, void *dev_id) static unsigned int apbuart_tx_empty(struct uart_port *port) { unsigned int status = UART_GET_STATUS(port); + return status & UART_STATUS_THE ? TIOCSER_TEMT : 0; } @@ -313,6 +315,7 @@ static int apbuart_verify_port(struct uart_port *port, struct serial_struct *ser) { int ret = 0; + if (ser->type != PORT_UNKNOWN && ser->type != PORT_APBUART) ret = -EINVAL; if (ser->irq < 0 || ser->irq >= NR_IRQS) @@ -418,6 +421,7 @@ static void apbuart_flush_fifo(struct uart_port *port) static void apbuart_console_putchar(struct uart_port *port, int ch) { unsigned int status; + do { status = UART_GET_STATUS(port); } while (!UART_TX_READY(status)); @@ -454,6 +458,7 @@ apbuart_console_get_options(struct uart_port *port, int *baud, if (UART_GET_CTRL(port) & (UART_CTRL_RE | UART_CTRL_TE)) { unsigned int quot, status; + status = UART_GET_STATUS(port); *parity = 'n'; @@ -618,7 +623,8 @@ static int __init grlib_apbuart_configure(void) port = &grlib_apbuart_ports[line]; port->mapbase = addr; - port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map)); + port->membase = ioremap(addr, + sizeof(struct grlib_apbuart_regs_map)); port->irq = 0; port->iotype = UPIO_MEM; port->ops = &grlib_apbuart_ops; @@ -626,7 +632,8 @@ static int __init grlib_apbuart_configure(void) port->flags = UPF_BOOT_AUTOCONF; port->line = line; port->uartclk = *freq_hz; - port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line); + port->fifosize = apbuart_scan_fifo_size( + (struct uart_port *) port, line); line++; /* We support maximum UART_NR uarts ... */