aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunzilog.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/sunzilog.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/sunzilog.c')
-rw-r--r--drivers/serial/sunzilog.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 15b6e1cb040b..0a3e10a4a35d 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -9,7 +9,7 @@
9 * C. Dost, Pete Zaitcev, Ted Ts'o and Alex Buell for their 9 * C. Dost, Pete Zaitcev, Ted Ts'o and Alex Buell for their
10 * work there. 10 * work there.
11 * 11 *
12 * Copyright (C) 2002, 2006 David S. Miller (davem@davemloft.net) 12 * Copyright (C) 2002, 2006, 2007 David S. Miller (davem@davemloft.net)
13 */ 13 */
14 14
15#include <linux/module.h> 15#include <linux/module.h>
@@ -1151,11 +1151,22 @@ sunzilog_console_write(struct console *con, const char *s, unsigned int count)
1151{ 1151{
1152 struct uart_sunzilog_port *up = &sunzilog_port_table[con->index]; 1152 struct uart_sunzilog_port *up = &sunzilog_port_table[con->index];
1153 unsigned long flags; 1153 unsigned long flags;
1154 int locked = 1;
1155
1156 local_irq_save(flags);
1157 if (up->port.sysrq) {
1158 locked = 0;
1159 } else if (oops_in_progress) {
1160 locked = spin_trylock(&up->port.lock);
1161 } else
1162 spin_lock(&up->port.lock);
1154 1163
1155 spin_lock_irqsave(&up->port.lock, flags);
1156 uart_console_write(&up->port, s, count, sunzilog_putchar); 1164 uart_console_write(&up->port, s, count, sunzilog_putchar);
1157 udelay(2); 1165 udelay(2);
1158 spin_unlock_irqrestore(&up->port.lock, flags); 1166
1167 if (locked)
1168 spin_unlock(&up->port.lock);
1169 local_irq_restore(flags);
1159} 1170}
1160 1171
1161static int __init sunzilog_console_setup(struct console *con, char *options) 1172static int __init sunzilog_console_setup(struct console *con, char *options)