From 491a7a436cc90e97d666cfc025e141ca3186f86c Mon Sep 17 00:00:00 2001 From: Rune Torgersen Date: Tue, 20 May 2008 14:39:17 -0500 Subject: 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 Signed-off-by: Kumar Gala --- drivers/serial/cpm_uart/cpm_uart_core.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) mode change 100644 => 100755 drivers/serial/cpm_uart/cpm_uart_core.c (limited to 'drivers/serial/cpm_uart') diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c old mode 100644 new mode 100755 index 43f58dc69fc9..d389a76b4afb --- 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); + } } -- cgit v1.2.3