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

tty/serial: Migrate imx 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: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Dmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20191213000657.931618-20-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
aa3479d2 4d9ec1c0

+1 -6
+1 -6
drivers/tty/serial/imx.c
··· 8 8 * Copyright (C) 2004 Pengutronix 9 9 */ 10 10 11 - #if defined(CONFIG_SERIAL_IMX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 12 - #define SUPPORT_SYSRQ 13 - #endif 14 - 15 11 #include <linux/module.h> 16 12 #include <linux/ioport.h> 17 13 #include <linux/init.h> ··· 775 779 if (rx & URXD_OVRRUN) 776 780 flg = TTY_OVERRUN; 777 781 778 - #ifdef SUPPORT_SYSRQ 779 782 sport->port.sysrq = 0; 780 - #endif 781 783 } 782 784 783 785 if (sport->port.ignore_status_mask & URXD_DUMMY_READ) ··· 2225 2231 sport->port.iotype = UPIO_MEM; 2226 2232 sport->port.irq = rxirq; 2227 2233 sport->port.fifosize = 32; 2234 + sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE); 2228 2235 sport->port.ops = &imx_uart_pops; 2229 2236 sport->port.rs485_config = imx_uart_rs485_config; 2230 2237 sport->port.flags = UPF_BOOT_AUTOCONF;