aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunsab.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-07-16 02:53:32 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-16 07:05:28 -0400
commitf3c681c028846bd5d39f563909409832a295ca69 (patch)
treeff492b31f535a76f1d8ad82b916bb6293f550123 /drivers/serial/sunsab.c
parent9918cc2e3275bf7f3561e4de1d5a3314183e71dc (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.c19
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;
860static void sunsab_console_putchar(struct uart_port *port, int c) 860static 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
873static void sunsab_console_write(struct console *con, const char *s, unsigned n) 868static 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
881static int sunsab_console_setup(struct console *con, char *options) 890static int sunsab_console_setup(struct console *con, char *options)