Skip to content

Commit

Permalink
cpm_uart: Fix cpm uart corruption with PREEMPT_RT
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rune Torgersen authored and Kumar Gala committed Jul 14, 2008
1 parent 0fe9b1e commit 491a7a4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/serial/cpm_uart/cpm_uart_core.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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);
}
}


Expand Down

0 comments on commit 491a7a4

Please sign in to comment.