Commit 596f63da authored by Douglas Anderson's avatar Douglas Anderson Committed by Greg Kroah-Hartman
Browse files

serial: 8250: Process sysrq at port unlock time



Let's take advantage of the new ("serial: core: Allow processing sysrq
at port unlock time") to handle sysrqs more cleanly.

Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3e6f8806
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@
 *    Copyright (C) 2016 Jeremy Kerr <jk@ozlabs.org>, IBM Corp.
 *    Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp.
 */
#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif

#include <linux/device.h>
#include <linux/module.h>
#include <linux/of_address.h>
@@ -293,7 +297,7 @@ static int aspeed_vuart_handle_irq(struct uart_port *port)
	if (lsr & UART_LSR_THRE)
		serial8250_tx_chars(up);

	spin_unlock_irqrestore(&port->lock, flags);
	uart_unlock_and_check_sysrq(port, flags);

	return 1;
}
+5 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif

#include <linux/serial_reg.h>
#include <linux/serial_8250.h>

@@ -54,7 +58,7 @@ int fsl8250_handle_irq(struct uart_port *port)
		serial8250_tx_chars(up);

	up->lsr_saved_flags = orig_lsr;
	spin_unlock_irqrestore(&up->port.lock, flags);
	uart_unlock_and_check_sysrq(&up->port, flags);
	return 1;
}
EXPORT_SYMBOL_GPL(fsl8250_handle_irq);
+5 −1
Original line number Diff line number Diff line
@@ -8,6 +8,10 @@
 *
 */

#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif

#include <linux/device.h>
#include <linux/io.h>
#include <linux/module.h>
@@ -1085,7 +1089,7 @@ static int omap_8250_dma_handle_irq(struct uart_port *port)
		}
	}

	spin_unlock_irqrestore(&port->lock, flags);
	uart_unlock_and_check_sysrq(port, flags);
	serial8250_rpm_put(up);
	return 1;
}
+3 −5
Original line number Diff line number Diff line
@@ -1755,7 +1755,7 @@ void serial8250_read_char(struct uart_8250_port *up, unsigned char lsr)
		else if (lsr & UART_LSR_FE)
			flag = TTY_FRAME;
	}
	if (uart_handle_sysrq_char(port, ch))
	if (uart_prepare_sysrq_char(port, ch))
		return;

	uart_insert_char(port, lsr, UART_LSR_OE, ch, flag);
@@ -1897,7 +1897,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
	if ((!up->dma || up->dma->tx_err) && (status & UART_LSR_THRE))
		serial8250_tx_chars(up);

	spin_unlock_irqrestore(&port->lock, flags);
	uart_unlock_and_check_sysrq(port, flags);
	return 1;
}
EXPORT_SYMBOL_GPL(serial8250_handle_irq);
@@ -3258,9 +3258,7 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s,

	serial8250_rpm_get(up);

	if (port->sysrq)
		locked = 0;
	else if (oops_in_progress)
	if (oops_in_progress)
		locked = spin_trylock_irqsave(&port->lock, flags);
	else
		spin_lock_irqsave(&port->lock, flags);