X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fserial%2F8250.c;h=674b15c78f680ab190b308dbbffaa01fd7482f6c;hb=9ec85c03d045d5ec24d6f15649a68646aefe88ba;hp=179c1f065e60a5662498c006f28c48b83828baa1;hpb=89a2fa5f2139be35e214bcf86a8291d6a1da75f2;p=powerpc.git diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 179c1f065e..674b15c78f 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -1528,7 +1528,7 @@ static int serial8250_startup(struct uart_port *port) /* * Clear the FIFO buffers and disable them. - * (they will be reeanbled in set_termios()) + * (they will be reenabled in set_termios()) */ serial8250_clear_fifos(up); @@ -2182,6 +2182,14 @@ static inline void wait_for_xmitr(struct uart_8250_port *up, int bits) } } +static void serial8250_console_putchar(struct uart_port *port, int ch) +{ + struct uart_8250_port *up = (struct uart_8250_port *)port; + + wait_for_xmitr(up, UART_LSR_THRE); + serial_out(up, UART_TX, ch); +} + /* * Print a string to the serial port trying not to disturb * any possible real use of the port... @@ -2193,12 +2201,11 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) { struct uart_8250_port *up = &serial8250_ports[co->index]; unsigned int ier; - int i; touch_nmi_watchdog(); /* - * First save the UER then disable the interrupts + * First save the IER then disable the interrupts */ ier = serial_in(up, UART_IER); @@ -2207,28 +2214,14 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) else serial_out(up, UART_IER, 0); - /* - * Now, do each character - */ - for (i = 0; i < count; i++, s++) { - wait_for_xmitr(up, UART_LSR_THRE); - - /* - * Send the character out. - * If a LF, also do CR... - */ - serial_out(up, UART_TX, *s); - if (*s == 10) { - wait_for_xmitr(up, UART_LSR_THRE); - serial_out(up, UART_TX, 13); - } - } + uart_console_write(&up->port, s, count, serial8250_console_putchar); /* * Finally, wait for transmitter to become empty * and restore the IER */ wait_for_xmitr(up, BOTH_EMPTY); + up->ier |= UART_IER_THRI; serial_out(up, UART_IER, ier | UART_IER_THRI); } @@ -2325,6 +2318,12 @@ static struct uart_driver serial8250_reg = { .cons = SERIAL8250_CONSOLE, }; +/* + * early_serial_setup - early registration for 8250 ports + * + * Setup an 8250 port structure prior to console initialisation. Use + * after console initialisation will cause undefined behaviour. + */ int __init early_serial_setup(struct uart_port *port) { if (port->line >= ARRAY_SIZE(serial8250_ports))