]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tty/serial: Migrate pnx8xxx_uart to use has_sysrq
authorDmitry Safonov <dima@arista.com>
Fri, 13 Dec 2019 00:06:31 +0000 (00:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Dec 2019 14:04:57 +0000 (15:04 +0100)
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>
drivers/tty/serial/pnx8xxx_uart.c

index 223a9499104e2ffc49a928aa4a6caa26cd07db8c..972d94e8d32b88fcc259f72cc762b53049c33a05 100644 (file)
  * Copyright (C) 2000 Deep Blue Solutions Ltd.
  */
 
-#if defined(CONFIG_SERIAL_PNX8XXX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-#define SUPPORT_SYSRQ
-#endif
-
 #include <linux/module.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
@@ -220,9 +216,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
                        else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
                                flg = TTY_FRAME;
 
-#ifdef SUPPORT_SYSRQ
                        sport->port.sysrq = 0;
-#endif
                }
 
                if (uart_handle_sysrq_char(&sport->port, ch))
@@ -800,6 +794,7 @@ static int pnx8xxx_serial_probe(struct platform_device *pdev)
                        if (pnx8xxx_ports[i].port.mapbase != res->start)
                                continue;
 
+                       pnx8xxx_ports[i].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PNX8XXX_CONSOLE);
                        pnx8xxx_ports[i].port.dev = &pdev->dev;
                        uart_add_one_port(&pnx8xxx_reg, &pnx8xxx_ports[i].port);
                        platform_set_drvdata(pdev, &pnx8xxx_ports[i]);