mirror of https://gitee.com/openkylin/linux.git
tty/serial: Migrate pnx8xxx_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-33-dima@arista.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f5e95c4fe4
commit
fd6dbe4e79
|
@ -10,10 +10,6 @@
|
||||||
* Copyright (C) 2000 Deep Blue Solutions Ltd.
|
* Copyright (C) 2000 Deep Blue Solutions Ltd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_SERIAL_PNX8XXX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
|
|
||||||
#define SUPPORT_SYSRQ
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
@ -220,9 +216,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
|
||||||
else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
|
else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
|
||||||
flg = TTY_FRAME;
|
flg = TTY_FRAME;
|
||||||
|
|
||||||
#ifdef SUPPORT_SYSRQ
|
|
||||||
sport->port.sysrq = 0;
|
sport->port.sysrq = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uart_handle_sysrq_char(&sport->port, ch))
|
if (uart_handle_sysrq_char(&sport->port, ch))
|
||||||
|
@ -800,6 +794,7 @@ static int pnx8xxx_serial_probe(struct platform_device *pdev)
|
||||||
if (pnx8xxx_ports[i].port.mapbase != res->start)
|
if (pnx8xxx_ports[i].port.mapbase != res->start)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
pnx8xxx_ports[i].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PNX8XXX_CONSOLE);
|
||||||
pnx8xxx_ports[i].port.dev = &pdev->dev;
|
pnx8xxx_ports[i].port.dev = &pdev->dev;
|
||||||
uart_add_one_port(&pnx8xxx_reg, &pnx8xxx_ports[i].port);
|
uart_add_one_port(&pnx8xxx_reg, &pnx8xxx_ports[i].port);
|
||||||
platform_set_drvdata(pdev, &pnx8xxx_ports[i]);
|
platform_set_drvdata(pdev, &pnx8xxx_ports[i]);
|
||||||
|
|
Loading…
Reference in New Issue