tty/serial: Migrate fsl_lpuart to use has_sysrq
authorDmitry Safonov <dima@arista.com>
Fri, 13 Dec 2019 00:06:17 +0000 (00:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Dec 2019 14:04:49 +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-19-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/fsl_lpuart.c

index 4e128d1..76c69d2 100644 (file)
@@ -5,10 +5,6 @@
  *  Copyright 2012-2014 Freescale Semiconductor, Inc.
  */
 
-#if defined(CONFIG_SERIAL_FSL_LPUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-#define SUPPORT_SYSRQ
-#endif
-
 #include <linux/clk.h>
 #include <linux/console.h>
 #include <linux/dma-mapping.h>
@@ -864,9 +860,7 @@ static void lpuart_rxint(struct lpuart_port *sport)
                        if (sr & UARTSR1_OR)
                                flg = TTY_OVERRUN;
 
-#ifdef SUPPORT_SYSRQ
                        sport->port.sysrq = 0;
-#endif
                }
 
                tty_insert_flip_char(port, rx, flg);
@@ -946,9 +940,7 @@ static void lpuart32_rxint(struct lpuart_port *sport)
                        if (sr & UARTSTAT_OR)
                                flg = TTY_OVERRUN;
 
-#ifdef SUPPORT_SYSRQ
                        sport->port.sysrq = 0;
-#endif
                }
 
                tty_insert_flip_char(port, rx, flg);
@@ -2461,6 +2453,7 @@ static int lpuart_probe(struct platform_device *pdev)
                sport->port.ops = &lpuart32_pops;
        else
                sport->port.ops = &lpuart_pops;
+       sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LPUART_CONSOLE);
        sport->port.flags = UPF_BOOT_AUTOCONF;
 
        if (lpuart_is_32(sport))