Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Douglas Anderson and committed by
Greg Kroah-Hartman
596f63da 3e6f8806

+18 -8
+5 -1
drivers/tty/serial/8250/8250_aspeed_vuart.c
··· 5 5 * Copyright (C) 2016 Jeremy Kerr <jk@ozlabs.org>, IBM Corp. 6 6 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp. 7 7 */ 8 + #if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 9 + #define SUPPORT_SYSRQ 10 + #endif 11 + 8 12 #include <linux/device.h> 9 13 #include <linux/module.h> 10 14 #include <linux/of_address.h> ··· 297 293 if (lsr & UART_LSR_THRE) 298 294 serial8250_tx_chars(up); 299 295 300 - spin_unlock_irqrestore(&port->lock, flags); 296 + uart_unlock_and_check_sysrq(port, flags); 301 297 302 298 return 1; 303 299 }
+5 -1
drivers/tty/serial/8250/8250_fsl.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 3 + #define SUPPORT_SYSRQ 4 + #endif 5 + 2 6 #include <linux/serial_reg.h> 3 7 #include <linux/serial_8250.h> 4 8 ··· 58 54 serial8250_tx_chars(up); 59 55 60 56 up->lsr_saved_flags = orig_lsr; 61 - spin_unlock_irqrestore(&up->port.lock, flags); 57 + uart_unlock_and_check_sysrq(&up->port, flags); 62 58 return 1; 63 59 } 64 60 EXPORT_SYMBOL_GPL(fsl8250_handle_irq);
+5 -1
drivers/tty/serial/8250/8250_omap.c
··· 8 8 * 9 9 */ 10 10 11 + #if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 12 + #define SUPPORT_SYSRQ 13 + #endif 14 + 11 15 #include <linux/device.h> 12 16 #include <linux/io.h> 13 17 #include <linux/module.h> ··· 1089 1085 } 1090 1086 } 1091 1087 1092 - spin_unlock_irqrestore(&port->lock, flags); 1088 + uart_unlock_and_check_sysrq(port, flags); 1093 1089 serial8250_rpm_put(up); 1094 1090 return 1; 1095 1091 }
+3 -5
drivers/tty/serial/8250/8250_port.c
··· 1755 1755 else if (lsr & UART_LSR_FE) 1756 1756 flag = TTY_FRAME; 1757 1757 } 1758 - if (uart_handle_sysrq_char(port, ch)) 1758 + if (uart_prepare_sysrq_char(port, ch)) 1759 1759 return; 1760 1760 1761 1761 uart_insert_char(port, lsr, UART_LSR_OE, ch, flag); ··· 1897 1897 if ((!up->dma || up->dma->tx_err) && (status & UART_LSR_THRE)) 1898 1898 serial8250_tx_chars(up); 1899 1899 1900 - spin_unlock_irqrestore(&port->lock, flags); 1900 + uart_unlock_and_check_sysrq(port, flags); 1901 1901 return 1; 1902 1902 } 1903 1903 EXPORT_SYMBOL_GPL(serial8250_handle_irq); ··· 3258 3258 3259 3259 serial8250_rpm_get(up); 3260 3260 3261 - if (port->sysrq) 3262 - locked = 0; 3263 - else if (oops_in_progress) 3261 + if (oops_in_progress) 3264 3262 locked = spin_trylock_irqsave(&port->lock, flags); 3265 3263 else 3266 3264 spin_lock_irqsave(&port->lock, flags);