Commit 8c1cbc5a authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Greg Kroah-Hartman

serial: bcm63xx: Use uart_prepare_sysrq_char().

The port lock is a spinlock_t which is becomes a sleeping lock on PREEMPT_RT.
The driver splits the locking function into two parts: local_irq_save() and
uart_port_lock() and this breaks PREEMPT_RT.

Delay handling sysrq until port lock is dropped.
Remove the special case in the console write routine an always use the
complete locking function.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20240301215246.891055-4-bigeasy@linutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 244a758b
...@@ -285,10 +285,9 @@ static void bcm_uart_do_rx(struct uart_port *port) ...@@ -285,10 +285,9 @@ static void bcm_uart_do_rx(struct uart_port *port)
flag = TTY_PARITY; flag = TTY_PARITY;
} }
if (uart_handle_sysrq_char(port, c)) if (uart_prepare_sysrq_char(port, c))
continue; continue;
if ((cstat & port->ignore_status_mask) == 0) if ((cstat & port->ignore_status_mask) == 0)
tty_insert_flip_char(tty_port, c, flag); tty_insert_flip_char(tty_port, c, flag);
...@@ -353,7 +352,7 @@ static irqreturn_t bcm_uart_interrupt(int irq, void *dev_id) ...@@ -353,7 +352,7 @@ static irqreturn_t bcm_uart_interrupt(int irq, void *dev_id)
estat & UART_EXTINP_DCD_MASK); estat & UART_EXTINP_DCD_MASK);
} }
uart_port_unlock(port); uart_unlock_and_check_sysrq(port);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -703,20 +702,14 @@ static void bcm_console_write(struct console *co, const char *s, ...@@ -703,20 +702,14 @@ static void bcm_console_write(struct console *co, const char *s,
{ {
struct uart_port *port; struct uart_port *port;
unsigned long flags; unsigned long flags;
int locked; int locked = 1;
port = &ports[co->index]; port = &ports[co->index];
local_irq_save(flags); if (oops_in_progress)
if (port->sysrq) { locked = uart_port_trylock_irqsave(port, &flags);
/* bcm_uart_interrupt() already took the lock */ else
locked = 0; uart_port_lock_irqsave(port, &flags);
} else if (oops_in_progress) {
locked = uart_port_trylock(port);
} else {
uart_port_lock(port);
locked = 1;
}
/* call helper to deal with \r\n */ /* call helper to deal with \r\n */
uart_console_write(port, s, count, bcm_console_putchar); uart_console_write(port, s, count, bcm_console_putchar);
...@@ -725,8 +718,7 @@ static void bcm_console_write(struct console *co, const char *s, ...@@ -725,8 +718,7 @@ static void bcm_console_write(struct console *co, const char *s,
wait_for_xmitr(port); wait_for_xmitr(port);
if (locked) if (locked)
uart_port_unlock(port); uart_port_unlock_irqrestore(port, flags);
local_irq_restore(flags);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment