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

tty/serial: Migrate amba-pl01* to use has_sysrq

The SUPPORT_SYSRQ ifdeffery is not nice as:
- May create misunderstanding about sizeof(struct uart_port) between
different objects
- Prevents moving functions from serial_core.h
- Reduces readability (well, it's ifdeffery - it's hard to follow)

In order to remove SUPPORT_SYSRQ, has_sysrq variable has been added.
Initialise it in driver's probe and remove ifdeffery.

Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20191213000657.931618-10-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
5f99fca9 4225eb0a

+2 -9
+1 -4
drivers/tty/serial/amba-pl010.c
··· 15 15 * and hooked into this driver. 16 16 */ 17 17 18 - #if defined(CONFIG_SERIAL_AMBA_PL010_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 19 - #define SUPPORT_SYSRQ 20 - #endif 21 - 22 18 #include <linux/module.h> 23 19 #include <linux/ioport.h> 24 20 #include <linux/init.h> ··· 724 728 uap->port.iotype = UPIO_MEM; 725 729 uap->port.irq = dev->irq[0]; 726 730 uap->port.fifosize = 16; 731 + uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_AMBA_PL010_CONSOLE); 727 732 uap->port.ops = &amba_pl010_pops; 728 733 uap->port.flags = UPF_BOOT_AUTOCONF; 729 734 uap->port.line = i;
+1 -5
drivers/tty/serial/amba-pl011.c
··· 16 16 * and hooked into this driver. 17 17 */ 18 18 19 - 20 - #if defined(CONFIG_SERIAL_AMBA_PL011_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 21 - #define SUPPORT_SYSRQ 22 - #endif 23 - 24 19 #include <linux/module.h> 25 20 #include <linux/ioport.h> 26 21 #include <linux/init.h> ··· 2572 2577 uap->port.mapbase = mmiobase->start; 2573 2578 uap->port.membase = base; 2574 2579 uap->port.fifosize = uap->fifosize; 2580 + uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_AMBA_PL011_CONSOLE); 2575 2581 uap->port.flags = UPF_BOOT_AUTOCONF; 2576 2582 uap->port.line = index; 2577 2583