Commit 63bd93ac authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Greg Kroah-Hartman

serial: omap: 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-7-bigeasy@linutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4e5788c0
...@@ -508,7 +508,7 @@ static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr) ...@@ -508,7 +508,7 @@ static void serial_omap_rdi(struct uart_omap_port *up, unsigned int lsr)
up->port.icount.rx++; up->port.icount.rx++;
if (uart_handle_sysrq_char(&up->port, ch)) if (uart_prepare_sysrq_char(&up->port, ch))
return; return;
uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, TTY_NORMAL); uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, TTY_NORMAL);
...@@ -563,7 +563,7 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id) ...@@ -563,7 +563,7 @@ static irqreturn_t serial_omap_irq(int irq, void *dev_id)
} }
} while (max_count--); } while (max_count--);
uart_port_unlock(&up->port); uart_unlock_and_check_sysrq(&up->port);
tty_flip_buffer_push(&up->port.state->port); tty_flip_buffer_push(&up->port.state->port);
...@@ -1212,13 +1212,10 @@ serial_omap_console_write(struct console *co, const char *s, ...@@ -1212,13 +1212,10 @@ serial_omap_console_write(struct console *co, const char *s,
unsigned int ier; unsigned int ier;
int locked = 1; int locked = 1;
local_irq_save(flags); if (oops_in_progress)
if (up->port.sysrq) locked = uart_port_trylock_irqsave(&up->port, &flags);
locked = 0;
else if (oops_in_progress)
locked = uart_port_trylock(&up->port);
else else
uart_port_lock(&up->port); uart_port_lock_irqsave(&up->port, &flags);
/* /*
* First save the IER then disable the interrupts * First save the IER then disable the interrupts
...@@ -1245,8 +1242,7 @@ serial_omap_console_write(struct console *co, const char *s, ...@@ -1245,8 +1242,7 @@ serial_omap_console_write(struct console *co, const char *s,
check_modem_status(up); check_modem_status(up);
if (locked) if (locked)
uart_port_unlock(&up->port); uart_port_unlock_irqrestore(&up->port, flags);
local_irq_restore(flags);
} }
static int __init static int __init
......
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