diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-05-02 16:04:29 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-05-02 16:04:29 +0100 |
commit | d8a5a8d7cc32e4474326e0ecc1b959063490efc9 (patch) | |
tree | b174cda624301fde6e020e346b60b5e8e31f6283 /drivers/serial/8250.c | |
parent | a88d75b257b2b28b26d7d4d2b640f05feb00ad53 (diff) | |
download | linux-d8a5a8d7cc32e4474326e0ecc1b959063490efc9.tar.bz2 |
[SERIAL] 8250: add locking to console write function
x86 SMP breaks as a result of the previous change, we have no real
option other than to add locking to the 8250 console write function.
If an oops is in progress, try to acquire the lock. If we fail to
do so, continue anyway.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r-- | drivers/serial/8250.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index e001ea0606ec..bbf78aaf9e01 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -2235,10 +2235,17 @@ static void serial8250_console_write(struct console *co, const char *s, unsigned int count) { struct uart_8250_port *up = &serial8250_ports[co->index]; + unsigned long flags; unsigned int ier; + int locked = 1; touch_nmi_watchdog(); + if (oops_in_progress) { + locked = spin_trylock_irqsave(&up->port.lock, flags); + } else + spin_lock_irqsave(&up->port.lock, flags); + /* * First save the IER then disable the interrupts */ @@ -2257,6 +2264,9 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) */ wait_for_xmitr(up, BOTH_EMPTY); serial_out(up, UART_IER, ier); + + if (locked) + spin_unlock_irqrestore(&up->port.lock, flags); } static int serial8250_console_setup(struct console *co, char *options) |