diff options
author | David Miller <davem@davemloft.net> | 2014-03-04 15:28:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-06 16:32:25 -0500 |
commit | e58e241c1788856f69d58821e91e5c988905252d (patch) | |
tree | af65c5c6385b28fc4d9af976f0fe8430fdf8429e | |
parent | c3bebc71c4bcdafa24b506adf0c1de3c1f77e2e0 (diff) |
sparc: serial: Clean up the locking for -rt
Signed-off-by: David S. Miller <davem@davemloft.net>
Tested-by: Allen Pais <allen.pais@oracle.com>
-rw-r--r-- | drivers/tty/serial/sunhv.c | 22 | ||||
-rw-r--r-- | drivers/tty/serial/sunsab.c | 14 | ||||
-rw-r--r-- | drivers/tty/serial/sunsu.c | 14 | ||||
-rw-r--r-- | drivers/tty/serial/sunzilog.c | 14 |
4 files changed, 25 insertions, 39 deletions
diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c index cf86e729532b..dc697cee248a 100644 --- a/drivers/tty/serial/sunhv.c +++ b/drivers/tty/serial/sunhv.c | |||
@@ -433,13 +433,10 @@ static void sunhv_console_write_paged(struct console *con, const char *s, unsign | |||
433 | unsigned long flags; | 433 | unsigned long flags; |
434 | int locked = 1; | 434 | int locked = 1; |
435 | 435 | ||
436 | local_irq_save(flags); | 436 | if (port->sysrq || oops_in_progress) |
437 | if (port->sysrq) { | 437 | locked = spin_trylock_irqsave(&port->lock, flags); |
438 | locked = 0; | 438 | else |
439 | } else if (oops_in_progress) { | 439 | spin_lock_irqsave(&port->lock, flags); |
440 | locked = spin_trylock(&port->lock); | ||
441 | } else | ||
442 | spin_lock(&port->lock); | ||
443 | 440 | ||
444 | while (n > 0) { | 441 | while (n > 0) { |
445 | unsigned long ra = __pa(con_write_page); | 442 | unsigned long ra = __pa(con_write_page); |
@@ -470,8 +467,7 @@ static void sunhv_console_write_paged(struct console *con, const char *s, unsign | |||
470 | } | 467 | } |
471 | 468 | ||
472 | if (locked) | 469 | if (locked) |
473 | spin_unlock(&port->lock); | 470 | spin_unlock_irqrestore(&port->lock, flags); |
474 | local_irq_restore(flags); | ||
475 | } | 471 | } |
476 | 472 | ||
477 | static inline void sunhv_console_putchar(struct uart_port *port, char c) | 473 | static inline void sunhv_console_putchar(struct uart_port *port, char c) |
@@ -492,7 +488,10 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig | |||
492 | unsigned long flags; | 488 | unsigned long flags; |
493 | int i, locked = 1; | 489 | int i, locked = 1; |
494 | 490 | ||
495 | local_irq_save(flags); | 491 | if (port->sysrq || oops_in_progress) |
492 | locked = spin_trylock_irqsave(&port->lock, flags); | ||
493 | else | ||
494 | spin_lock_irqsave(&port->lock, flags); | ||
496 | if (port->sysrq) { | 495 | if (port->sysrq) { |
497 | locked = 0; | 496 | locked = 0; |
498 | } else if (oops_in_progress) { | 497 | } else if (oops_in_progress) { |
@@ -507,8 +506,7 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig | |||
507 | } | 506 | } |
508 | 507 | ||
509 | if (locked) | 508 | if (locked) |
510 | spin_unlock(&port->lock); | 509 | spin_unlock_irqrestore(&port->lock, flags); |
511 | local_irq_restore(flags); | ||
512 | } | 510 | } |
513 | 511 | ||
514 | static struct console sunhv_console = { | 512 | static struct console sunhv_console = { |
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index 380fb5355cb2..5faa8e905e98 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c | |||
@@ -844,20 +844,16 @@ static void sunsab_console_write(struct console *con, const char *s, unsigned n) | |||
844 | unsigned long flags; | 844 | unsigned long flags; |
845 | int locked = 1; | 845 | int locked = 1; |
846 | 846 | ||
847 | local_irq_save(flags); | 847 | if (up->port.sysrq || oops_in_progress) |
848 | if (up->port.sysrq) { | 848 | locked = spin_trylock_irqsave(&up->port.lock, flags); |
849 | locked = 0; | 849 | else |
850 | } else if (oops_in_progress) { | 850 | spin_lock_irqsave(&up->port.lock, flags); |
851 | locked = spin_trylock(&up->port.lock); | ||
852 | } else | ||
853 | spin_lock(&up->port.lock); | ||
854 | 851 | ||
855 | uart_console_write(&up->port, s, n, sunsab_console_putchar); | 852 | uart_console_write(&up->port, s, n, sunsab_console_putchar); |
856 | sunsab_tec_wait(up); | 853 | sunsab_tec_wait(up); |
857 | 854 | ||
858 | if (locked) | 855 | if (locked) |
859 | spin_unlock(&up->port.lock); | 856 | spin_unlock_irqrestore(&up->port.lock, flags); |
860 | local_irq_restore(flags); | ||
861 | } | 857 | } |
862 | 858 | ||
863 | static int sunsab_console_setup(struct console *con, char *options) | 859 | static int sunsab_console_setup(struct console *con, char *options) |
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index db79b76f5c8e..9a0f24f83720 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -1295,13 +1295,10 @@ static void sunsu_console_write(struct console *co, const char *s, | |||
1295 | unsigned int ier; | 1295 | unsigned int ier; |
1296 | int locked = 1; | 1296 | int locked = 1; |
1297 | 1297 | ||
1298 | local_irq_save(flags); | 1298 | if (up->port.sysrq || oops_in_progress) |
1299 | if (up->port.sysrq) { | 1299 | locked = spin_trylock_irqsave(&up->port.lock, flags); |
1300 | locked = 0; | 1300 | else |
1301 | } else if (oops_in_progress) { | 1301 | spin_lock_irqsave(&up->port.lock, flags); |
1302 | locked = spin_trylock(&up->port.lock); | ||
1303 | } else | ||
1304 | spin_lock(&up->port.lock); | ||
1305 | 1302 | ||
1306 | /* | 1303 | /* |
1307 | * First save the UER then disable the interrupts | 1304 | * First save the UER then disable the interrupts |
@@ -1319,8 +1316,7 @@ static void sunsu_console_write(struct console *co, const char *s, | |||
1319 | serial_out(up, UART_IER, ier); | 1316 | serial_out(up, UART_IER, ier); |
1320 | 1317 | ||
1321 | if (locked) | 1318 | if (locked) |
1322 | spin_unlock(&up->port.lock); | 1319 | spin_unlock_irqrestore(&up->port.lock, flags); |
1323 | local_irq_restore(flags); | ||
1324 | } | 1320 | } |
1325 | 1321 | ||
1326 | /* | 1322 | /* |
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index 45a8c6aa5837..a2c40ed287d2 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -1195,20 +1195,16 @@ sunzilog_console_write(struct console *con, const char *s, unsigned int count) | |||
1195 | unsigned long flags; | 1195 | unsigned long flags; |
1196 | int locked = 1; | 1196 | int locked = 1; |
1197 | 1197 | ||
1198 | local_irq_save(flags); | 1198 | if (up->port.sysrq || oops_in_progress) |
1199 | if (up->port.sysrq) { | 1199 | locked = spin_trylock_irqsave(&up->port.lock, flags); |
1200 | locked = 0; | 1200 | else |
1201 | } else if (oops_in_progress) { | 1201 | spin_lock_irqsave(&up->port.lock, flags); |
1202 | locked = spin_trylock(&up->port.lock); | ||
1203 | } else | ||
1204 | spin_lock(&up->port.lock); | ||
1205 | 1202 | ||
1206 | uart_console_write(&up->port, s, count, sunzilog_putchar); | 1203 | uart_console_write(&up->port, s, count, sunzilog_putchar); |
1207 | udelay(2); | 1204 | udelay(2); |
1208 | 1205 | ||
1209 | if (locked) | 1206 | if (locked) |
1210 | spin_unlock(&up->port.lock); | 1207 | spin_unlock_irqrestore(&up->port.lock, flags); |
1211 | local_irq_restore(flags); | ||
1212 | } | 1208 | } |
1213 | 1209 | ||
1214 | static int __init sunzilog_console_setup(struct console *con, char *options) | 1210 | static int __init sunzilog_console_setup(struct console *con, char *options) |