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 /drivers/tty/serial/sunhv.c | |
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>
Diffstat (limited to 'drivers/tty/serial/sunhv.c')
-rw-r--r-- | drivers/tty/serial/sunhv.c | 22 |
1 files changed, 10 insertions, 12 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 = { |