[PATCH] Fix cpm uart corruption with PREEMPT_RT

Rune Torgersen runet at innovsys.com
Wed May 21 05:28:16 EST 2008


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.

Signed-off-by: Rune Torgersen <runet at innovsys.com>

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index fb93403..79c109d 100755
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -1214,7 +1214,9 @@ 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;
 
+	spin_lock_irqsave(&pinfo->port.lock, flags);
 	/* Get the address of the host memory buffer.
 	 */
 	bdp = pinfo->tx_cur;
@@ -1282,6 +1284,8 @@ static void cpm_uart_console_write(struct console *co, const char *s,
 		;
 
 	pinfo->tx_cur = bdp;
+
+	spin_unlock_irqrestore(&pinfo->port.lock, flags);
 }
 
 



More information about the Linuxppc-dev mailing list