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

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

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
bb3ecd96 b062e4aa

+1 -5
+1 -5
drivers/tty/serial/pch_uart.c
··· 2 2 /* 3 3 *Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. 4 4 */ 5 - #if defined(CONFIG_SERIAL_PCH_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 6 - #define SUPPORT_SYSRQ 7 - #endif 8 5 #include <linux/kernel.h> 9 6 #include <linux/serial_reg.h> 10 7 #include <linux/slab.h> ··· 584 587 if (uart_handle_break(port)) 585 588 continue; 586 589 } 587 - #ifdef SUPPORT_SYSRQ 588 590 if (port->sysrq) { 589 591 if (uart_handle_sysrq_char(port, rbr)) 590 592 continue; 591 593 } 592 - #endif 593 594 594 595 buf[i++] = rbr; 595 596 } ··· 1791 1796 priv->port.flags = UPF_BOOT_AUTOCONF; 1792 1797 priv->port.fifosize = fifosize; 1793 1798 priv->port.line = board->line_no; 1799 + priv->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PCH_UART_CONSOLE); 1794 1800 priv->trigger = PCH_UART_HAL_TRIGGER_M; 1795 1801 1796 1802 snprintf(priv->irq_name, IRQ_NAME_SIZE,