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

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

While at it, remove forward-declaration of atmel_console - it wasn't
needed even at the moment the driver was first time introduced:
commit 1e6c9c2878c9 ("[ARM] 3242/2: AT91RM9200 support for 2.6 (Serial)")

Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Richard Genoud <richard.genoud@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Dmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20191213000657.931618-13-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dmitry Safonov and committed by
Greg Kroah-Hartman
078abd98 933505e9

+1 -8
+1 -8
drivers/tty/serial/atmel_serial.c
··· 51 51 #define ATMEL_RTS_HIGH_OFFSET 16 52 52 #define ATMEL_RTS_LOW_OFFSET 20 53 53 54 - #if defined(CONFIG_SERIAL_ATMEL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 55 - #define SUPPORT_SYSRQ 56 - #endif 57 - 58 54 #include <linux/serial_core.h> 59 55 60 56 #include "serial_mctrl_gpio.h" ··· 191 195 192 196 static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART]; 193 197 static DECLARE_BITMAP(atmel_ports_in_use, ATMEL_MAX_UART); 194 - 195 - #ifdef SUPPORT_SYSRQ 196 - static struct console atmel_console; 197 - #endif 198 198 199 199 #if defined(CONFIG_OF) 200 200 static const struct of_device_id atmel_serial_dt_ids[] = { ··· 2869 2877 atmel_port = &atmel_ports[ret]; 2870 2878 atmel_port->backup_imr = 0; 2871 2879 atmel_port->uart.line = ret; 2880 + atmel_port->uart.has_sysrq = IS_ENABLED(CONFIG_SERIAL_ATMEL_CONSOLE); 2872 2881 atmel_serial_probe_fifos(atmel_port, pdev); 2873 2882 2874 2883 atomic_set(&atmel_port->tasklet_shutdown, 0);