cb653170efcb0745af434229ec6a1620fd8a1c7e
[openwrt/staging/yousong.git] /
1 From 72ff51d8dd262d1fef25baedc2ac35116435be47 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
3 Date: Wed, 6 Mar 2019 17:54:03 +0100
4 Subject: [PATCH] serial: ar933x_uart: Fix build failure with disabled console
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Andrey has reported on OpenWrt's bug tracking system[1], that he
10 currently can't use ar93xx_uart as pure serial UART without console
11 (CONFIG_SERIAL_8250_CONSOLE and CONFIG_SERIAL_AR933X_CONSOLE undefined),
12 because compilation ends with following error:
13
14 ar933x_uart.c: In function 'ar933x_uart_console_write':
15 ar933x_uart.c:550:14: error: 'struct uart_port' has no
16 member named 'sysrq'
17
18 So this patch moves all the code related to console handling behind
19 series of CONFIG_SERIAL_AR933X_CONSOLE ifdefs.
20
21 1. https://bugs.openwrt.org/index.php?do=details&task_id=2152
22
23 Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24 Cc: Jiri Slaby <jslaby@suse.com>
25 Cc: Andrey Batyiev <batyiev@gmail.com>
26 Reported-by: Andrey Batyiev <batyiev@gmail.com>
27 Tested-by: Andrey Batyiev <batyiev@gmail.com>
28 Signed-off-by: Petr Štetiar <ynezz@true.cz>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30 ---
31 drivers/tty/serial/ar933x_uart.c | 24 ++++++++----------------
32 1 file changed, 8 insertions(+), 16 deletions(-)
33
34 diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
35 index db5df3d..3bdd56a 100644
36 --- a/drivers/tty/serial/ar933x_uart.c
37 +++ b/drivers/tty/serial/ar933x_uart.c
38 @@ -49,11 +49,6 @@ struct ar933x_uart_port {
39 struct clk *clk;
40 };
41
42 -static inline bool ar933x_uart_console_enabled(void)
43 -{
44 - return IS_ENABLED(CONFIG_SERIAL_AR933X_CONSOLE);
45 -}
46 -
47 static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up,
48 int offset)
49 {
50 @@ -508,6 +503,7 @@ static int ar933x_uart_verify_port(struct uart_port *port,
51 .verify_port = ar933x_uart_verify_port,
52 };
53
54 +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
55 static struct ar933x_uart_port *
56 ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS];
57
58 @@ -604,14 +600,7 @@ static int ar933x_uart_console_setup(struct console *co, char *options)
59 .index = -1,
60 .data = &ar933x_uart_driver,
61 };
62 -
63 -static void ar933x_uart_add_console_port(struct ar933x_uart_port *up)
64 -{
65 - if (!ar933x_uart_console_enabled())
66 - return;
67 -
68 - ar933x_console_ports[up->port.line] = up;
69 -}
70 +#endif /* CONFIG_SERIAL_AR933X_CONSOLE */
71
72 static struct uart_driver ar933x_uart_driver = {
73 .owner = THIS_MODULE,
74 @@ -700,7 +689,9 @@ static int ar933x_uart_probe(struct platform_device *pdev)
75 baud = ar933x_uart_get_baud(port->uartclk, 0, AR933X_UART_MAX_STEP);
76 up->max_baud = min_t(unsigned int, baud, AR933X_UART_MAX_BAUD);
77
78 - ar933x_uart_add_console_port(up);
79 +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
80 + ar933x_console_ports[up->port.line] = up;
81 +#endif
82
83 ret = uart_add_one_port(&ar933x_uart_driver, &up->port);
84 if (ret)
85 @@ -749,8 +740,9 @@ static int __init ar933x_uart_init(void)
86 {
87 int ret;
88
89 - if (ar933x_uart_console_enabled())
90 - ar933x_uart_driver.cons = &ar933x_uart_console;
91 +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
92 + ar933x_uart_driver.cons = &ar933x_uart_console;
93 +#endif
94
95 ret = uart_register_driver(&ar933x_uart_driver);
96 if (ret)
97 --
98 1.9.1
99