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

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

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
fd6dbe4e f5e95c4f

+1 -6
+1 -6
drivers/tty/serial/pnx8xxx_uart.c
··· 10 10 * Copyright (C) 2000 Deep Blue Solutions Ltd. 11 11 */ 12 12 13 - #if defined(CONFIG_SERIAL_PNX8XXX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 14 - #define SUPPORT_SYSRQ 15 - #endif 16 - 17 13 #include <linux/module.h> 18 14 #include <linux/ioport.h> 19 15 #include <linux/init.h> ··· 216 220 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) 217 221 flg = TTY_FRAME; 218 222 219 - #ifdef SUPPORT_SYSRQ 220 223 sport->port.sysrq = 0; 221 - #endif 222 224 } 223 225 224 226 if (uart_handle_sysrq_char(&sport->port, ch)) ··· 794 800 if (pnx8xxx_ports[i].port.mapbase != res->start) 795 801 continue; 796 802 803 + pnx8xxx_ports[i].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PNX8XXX_CONSOLE); 797 804 pnx8xxx_ports[i].port.dev = &pdev->dev; 798 805 uart_add_one_port(&pnx8xxx_reg, &pnx8xxx_ports[i].port); 799 806 platform_set_drvdata(pdev, &pnx8xxx_ports[i]);