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

tty/serial: Migrate stm32-usart 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.

Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Signed-off-by: Dmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20191213000657.931618-45-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
9feedaa7 39e17343

+1 -4
+1 -4
drivers/tty/serial/stm32-usart.c
··· 8 8 * Inspired by st-asc.c from STMicroelectronics (c) 9 9 */ 10 10 11 - #if defined(CONFIG_SERIAL_STM32_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 12 - #define SUPPORT_SYSRQ 13 - #endif 14 - 15 11 #include <linux/clk.h> 16 12 #include <linux/console.h> 17 13 #include <linux/delay.h> ··· 922 926 port->ops = &stm32_uart_ops; 923 927 port->dev = &pdev->dev; 924 928 port->fifosize = stm32port->info->cfg.fifosize; 929 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_STM32_CONSOLE); 925 930 926 931 ret = platform_get_irq(pdev, 0); 927 932 if (ret <= 0)