Commit 244a758b authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Greg Kroah-Hartman

serial: ar933x: 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-3-bigeasy@linutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2432f71c
...@@ -378,7 +378,7 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up) ...@@ -378,7 +378,7 @@ static void ar933x_uart_rx_chars(struct ar933x_uart_port *up)
up->port.icount.rx++; up->port.icount.rx++;
ch = rdata & AR933X_UART_DATA_TX_RX_MASK; ch = rdata & AR933X_UART_DATA_TX_RX_MASK;
if (uart_handle_sysrq_char(&up->port, ch)) if (uart_prepare_sysrq_char(&up->port, ch))
continue; continue;
if ((up->port.ignore_status_mask & AR933X_DUMMY_STATUS_RD) == 0) if ((up->port.ignore_status_mask & AR933X_DUMMY_STATUS_RD) == 0)
...@@ -468,7 +468,7 @@ static irqreturn_t ar933x_uart_interrupt(int irq, void *dev_id) ...@@ -468,7 +468,7 @@ static irqreturn_t ar933x_uart_interrupt(int irq, void *dev_id)
ar933x_uart_tx_chars(up); ar933x_uart_tx_chars(up);
} }
uart_port_unlock(&up->port); uart_unlock_and_check_sysrq(&up->port);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -627,14 +627,10 @@ static void ar933x_uart_console_write(struct console *co, const char *s, ...@@ -627,14 +627,10 @@ static void ar933x_uart_console_write(struct console *co, const char *s,
unsigned int int_en; unsigned int int_en;
int locked = 1; int locked = 1;
local_irq_save(flags); if (oops_in_progress)
locked = uart_port_trylock_irqsave(&up->port, &flags);
if (up->port.sysrq)
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
...@@ -654,9 +650,7 @@ static void ar933x_uart_console_write(struct console *co, const char *s, ...@@ -654,9 +650,7 @@ static void ar933x_uart_console_write(struct console *co, const char *s,
ar933x_uart_write(up, AR933X_UART_INT_REG, AR933X_UART_INT_ALLINTS); ar933x_uart_write(up, AR933X_UART_INT_REG, AR933X_UART_INT_ALLINTS);
if (locked) if (locked)
uart_port_unlock(&up->port); uart_port_unlock_irqrestore(&up->port, flags);
local_irq_restore(flags);
} }
static int ar933x_uart_console_setup(struct console *co, char *options) static int ar933x_uart_console_setup(struct console *co, char *options)
......
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