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

tty/serial: Migrate sa1100 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.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20191213000657.931618-37-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
386ae3b7 8f122698

+1 -6
+1 -6
drivers/tty/serial/sa1100.c
··· 7 7 * Copyright (C) 2000 Deep Blue Solutions Ltd. 8 8 */ 9 9 10 - #if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 11 - #define SUPPORT_SYSRQ 12 - #endif 13 - 14 10 #include <linux/module.h> 15 11 #include <linux/ioport.h> 16 12 #include <linux/init.h> ··· 210 214 else if (status & UTSR1_TO_SM(UTSR1_FRE)) 211 215 flg = TTY_FRAME; 212 216 213 - #ifdef SUPPORT_SYSRQ 214 217 sport->port.sysrq = 0; 215 - #endif 216 218 } 217 219 218 220 if (uart_handle_sysrq_char(&sport->port, ch)) ··· 854 860 static int sa1100_serial_add_one_port(struct sa1100_port *sport, struct platform_device *dev) 855 861 { 856 862 sport->port.dev = &dev->dev; 863 + sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SA1100_CONSOLE); 857 864 858 865 // mctrl_gpio_init() requires that the GPIO driver supports interrupts, 859 866 // but we need to support GPIO drivers for hardware that has no such