tty: xuartps: Improve sysrq handling
Handling magic sysrq included dropping a lock to avoid a deadlock that happened when cdns_uart_console_write tried to acquire a lock in the from the sysrq code path. By making the acquisition of the lock in cdns_uart_console_write depending on port->sysrq, cdns_uart_handle_rx can be simplified to simply call uart_handle_sysrq. Suggested-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
354fb1a7d7
commit
74ea66d4ca
|
@ -220,20 +220,8 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SUPPORT_SYSRQ
|
if (uart_handle_sysrq_char(port, data))
|
||||||
/*
|
continue;
|
||||||
* uart_handle_sysrq_char() doesn't work if
|
|
||||||
* spinlocked, for some reason
|
|
||||||
*/
|
|
||||||
if (port->sysrq) {
|
|
||||||
spin_unlock(&port->lock);
|
|
||||||
if (uart_handle_sysrq_char(port, data)) {
|
|
||||||
spin_lock(&port->lock);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
spin_lock(&port->lock);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
port->icount.rx++;
|
port->icount.rx++;
|
||||||
|
|
||||||
|
@ -1128,7 +1116,9 @@ static void cdns_uart_console_write(struct console *co, const char *s,
|
||||||
unsigned int imr, ctrl;
|
unsigned int imr, ctrl;
|
||||||
int locked = 1;
|
int locked = 1;
|
||||||
|
|
||||||
if (oops_in_progress)
|
if (port->sysrq)
|
||||||
|
locked = 0;
|
||||||
|
else if (oops_in_progress)
|
||||||
locked = spin_trylock_irqsave(&port->lock, flags);
|
locked = spin_trylock_irqsave(&port->lock, flags);
|
||||||
else
|
else
|
||||||
spin_lock_irqsave(&port->lock, flags);
|
spin_lock_irqsave(&port->lock, flags);
|
||||||
|
|
Loading…
Reference in New Issue