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

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

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
4151bbed 79bb6625

+1 -7
+1 -7
drivers/tty/serial/fsl_linflexuart.c
··· 6 6 * Copyright 2017-2019 NXP 7 7 */ 8 8 9 - #if defined(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE) && \ 10 - defined(CONFIG_MAGIC_SYSRQ) 11 - #define SUPPORT_SYSRQ 12 - #endif 13 - 14 9 #include <linux/console.h> 15 10 #include <linux/io.h> 16 11 #include <linux/irq.h> ··· 274 279 if (brk) { 275 280 uart_handle_break(sport); 276 281 } else { 277 - #ifdef SUPPORT_SYSRQ 278 282 if (uart_handle_sysrq_char(sport, (unsigned char)rx)) 279 283 continue; 280 - #endif 281 284 tty_insert_flip_char(port, rx, flg); 282 285 } 283 286 } ··· 856 863 sport->irq = platform_get_irq(pdev, 0); 857 864 sport->ops = &linflex_pops; 858 865 sport->flags = UPF_BOOT_AUTOCONF; 866 + sport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE); 859 867 860 868 linflex_ports[sport->line] = sport; 861 869