diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-07-16 02:53:32 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-16 07:05:28 -0400 |
commit | f3c681c028846bd5d39f563909409832a295ca69 (patch) | |
tree | ff492b31f535a76f1d8ad82b916bb6293f550123 /drivers/serial/sunsab.c | |
parent | 9918cc2e3275bf7f3561e4de1d5a3314183e71dc (diff) |
[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/sunsab.c')
-rw-r--r-- | drivers/serial/sunsab.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index deb9ab4b5a0b..8a0f9e4408d4 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -860,22 +860,31 @@ static int num_channels; | |||
860 | static void sunsab_console_putchar(struct uart_port *port, int c) | 860 | static void sunsab_console_putchar(struct uart_port *port, int c) |
861 | { | 861 | { |
862 | struct uart_sunsab_port *up = (struct uart_sunsab_port *)port; | 862 | struct uart_sunsab_port *up = (struct uart_sunsab_port *)port; |
863 | unsigned long flags; | ||
864 | |||
865 | spin_lock_irqsave(&up->port.lock, flags); | ||
866 | 863 | ||
867 | sunsab_tec_wait(up); | 864 | sunsab_tec_wait(up); |
868 | writeb(c, &up->regs->w.tic); | 865 | writeb(c, &up->regs->w.tic); |
869 | |||
870 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
871 | } | 866 | } |
872 | 867 | ||
873 | static void sunsab_console_write(struct console *con, const char *s, unsigned n) | 868 | static void sunsab_console_write(struct console *con, const char *s, unsigned n) |
874 | { | 869 | { |
875 | struct uart_sunsab_port *up = &sunsab_ports[con->index]; | 870 | struct uart_sunsab_port *up = &sunsab_ports[con->index]; |
871 | unsigned long flags; | ||
872 | int locked = 1; | ||
873 | |||
874 | local_irq_save(flags); | ||
875 | if (up->port.sysrq) { | ||
876 | locked = 0; | ||
877 | } else if (oops_in_progress) { | ||
878 | locked = spin_trylock(&up->port.lock); | ||
879 | } else | ||
880 | spin_lock(&up->port.lock); | ||
876 | 881 | ||
877 | uart_console_write(&up->port, s, n, sunsab_console_putchar); | 882 | uart_console_write(&up->port, s, n, sunsab_console_putchar); |
878 | sunsab_tec_wait(up); | 883 | sunsab_tec_wait(up); |
884 | |||
885 | if (locked) | ||
886 | spin_unlock(&up->port.lock); | ||
887 | local_irq_restore(flags); | ||
879 | } | 888 | } |
880 | 889 | ||
881 | static int sunsab_console_setup(struct console *con, char *options) | 890 | static int sunsab_console_setup(struct console *con, char *options) |