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

tty/serial: Migrate ip22zilog 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-21-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
79307e05 aa3479d2

+3 -4
+3 -4
drivers/tty/serial/ip22zilog.c
··· 38 38 #include <asm/sgi/hpc3.h> 39 39 #include <asm/sgi/ip22.h> 40 40 41 - #if defined(CONFIG_SERIAL_IP22_ZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 42 - #define SUPPORT_SYSRQ 43 - #endif 44 - 45 41 #include <linux/serial_core.h> 46 42 47 43 #include "ip22zilog.h" ··· 1076 1080 1077 1081 static void __init ip22zilog_prepare(void) 1078 1082 { 1083 + unsigned char sysrq_on = IS_ENABLED(CONFIG_SERIAL_IP22_ZILOG_CONSOLE); 1079 1084 struct uart_ip22zilog_port *up; 1080 1085 struct zilog_layout *rp; 1081 1086 int channel, chip; ··· 1112 1115 up[(chip * 2) + 0].port.irq = zilog_irq; 1113 1116 up[(chip * 2) + 0].port.uartclk = ZS_CLOCK; 1114 1117 up[(chip * 2) + 0].port.fifosize = 1; 1118 + up[(chip * 2) + 0].port.has_sysrq = sysrq_on; 1115 1119 up[(chip * 2) + 0].port.ops = &ip22zilog_pops; 1116 1120 up[(chip * 2) + 0].port.type = PORT_IP22ZILOG; 1117 1121 up[(chip * 2) + 0].port.flags = 0; ··· 1124 1126 up[(chip * 2) + 1].port.irq = zilog_irq; 1125 1127 up[(chip * 2) + 1].port.uartclk = ZS_CLOCK; 1126 1128 up[(chip * 2) + 1].port.fifosize = 1; 1129 + up[(chip * 2) + 1].port.has_sysrq = sysrq_on; 1127 1130 up[(chip * 2) + 1].port.ops = &ip22zilog_pops; 1128 1131 up[(chip * 2) + 1].port.type = PORT_IP22ZILOG; 1129 1132 up[(chip * 2) + 1].port.line = (chip * 2) + 1;