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

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

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
410090d2 76f82db9

+2 -7
+2 -7
drivers/tty/serial/cpm_uart/cpm_uart_core.c
··· 40 40 #include <asm/fs_pd.h> 41 41 #include <asm/udbg.h> 42 42 43 - #if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 44 - #define SUPPORT_SYSRQ 45 - #endif 46 - 47 43 #include <linux/serial_core.h> 48 44 #include <linux/kernel.h> 49 45 ··· 343 347 /* ASSUMPTION: it contains nothing valid */ 344 348 i = 0; 345 349 } 346 - #ifdef SUPPORT_SYSRQ 347 350 port->sysrq = 0; 348 - #endif 349 351 goto error_return; 350 352 } 351 353 ··· 1198 1204 pinfo->port.uartclk = ppc_proc_freq; 1199 1205 pinfo->port.mapbase = (unsigned long)mem; 1200 1206 pinfo->port.type = PORT_CPM; 1201 - pinfo->port.ops = &cpm_uart_pops, 1207 + pinfo->port.ops = &cpm_uart_pops; 1208 + pinfo->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_CPM_CONSOLE); 1202 1209 pinfo->port.iotype = UPIO_MEM; 1203 1210 pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; 1204 1211 spin_lock_init(&pinfo->port.lock);