diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-07-15 23:53:32 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-16 04:05:28 -0700 |
commit | f3c681c028846bd5d39f563909409832a295ca69 (patch) | |
tree | ff492b31f535a76f1d8ad82b916bb6293f550123 /drivers/serial/sunsu.c | |
parent | 9918cc2e3275bf7f3561e4de1d5a3314183e71dc (diff) | |
download | kernel-common-f3c681c028846bd5d39f563909409832a295ca69.tar.gz kernel-common-f3c681c028846bd5d39f563909409832a295ca69.tar.bz2 kernel-common-f3c681c028846bd5d39f563909409832a295ca69.zip |
[SERIAL]: Fix console write locking in sparc drivers.
Mirror the logic in 8250 for proper console write locking
when SYSRQ is triggered or an OOPS is in progress.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/serial/sunsu.c')
-rw-r--r-- | drivers/serial/sunsu.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 2a63cdba3208..26d720baf88c 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c @@ -1288,7 +1288,17 @@ static void sunsu_console_write(struct console *co, const char *s, unsigned int count) { struct uart_sunsu_port *up = &sunsu_ports[co->index]; + unsigned long flags; unsigned int ier; + int locked = 1; + + local_irq_save(flags); + if (up->port.sysrq) { + locked = 0; + } else if (oops_in_progress) { + locked = spin_trylock(&up->port.lock); + } else + spin_lock(&up->port.lock); /* * First save the UER then disable the interrupts @@ -1304,6 +1314,10 @@ static void sunsu_console_write(struct console *co, const char *s, */ wait_for_xmitr(up); serial_out(up, UART_IER, ier); + + if (locked) + spin_unlock(&up->port.lock); + local_irq_restore(flags); } /* |