diff options
author | Rune Torgersen <runet@innovsys.com> | 2008-05-20 23:39:17 +0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-07-14 16:55:29 +0400 |
commit | 491a7a436cc90e97d666cfc025e141ca3186f86c (patch) | |
tree | 9cc5b8ec60655fcceeb0df740c14b11362e8ddf1 /drivers/serial/cpm_uart | |
parent | 0fe9b1ea60bc209c8c87afcbb1c2ec0b28835aa4 (diff) | |
download | linux-491a7a436cc90e97d666cfc025e141ca3186f86c.tar.xz |
cpm_uart: Fix cpm uart corruption with PREEMPT_RT
Fix CPM serial port corruption when running with CONFIG_PREEMPT_RT.
Userland usage of console, and kernel printf's were stepping on each others toes.
Also only take lock if not in an oops.
Signed-off-by: Rune Torgersen <runet@innovsys.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers/serial/cpm_uart')
-rwxr-xr-x[-rw-r--r--] | drivers/serial/cpm_uart/cpm_uart_core.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index 43f58dc69fc9..d389a76b4afb 100644..100755 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c @@ -969,6 +969,14 @@ static void cpm_uart_console_write(struct console *co, const char *s, unsigned int i; cbd_t __iomem *bdp, *bdbase; unsigned char *cp; + unsigned long flags; + int nolock = oops_in_progress; + + if (unlikely(nolock)) { + local_irq_save(flags); + } else { + spin_lock_irqsave(&pinfo->port.lock, flags); + } /* Get the address of the host memory buffer. */ @@ -1030,6 +1038,12 @@ static void cpm_uart_console_write(struct console *co, const char *s, ; pinfo->tx_cur = bdp; + + if (unlikely(nolock)) { + local_irq_restore(flags); + } else { + spin_unlock_irqrestore(&pinfo->port.lock, flags); + } } |