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
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
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:
14 ar933x_uart.c: In function 'ar933x_uart_console_write':
15 ar933x_uart.c:550:14: error: 'struct uart_port' has no
18 So this patch moves all the code related to console handling behind
19 series of CONFIG_SERIAL_AR933X_CONSOLE ifdefs.
21 1. https://bugs.openwrt.org/index.php?do=details&task_id=2152
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>
31 drivers/tty/serial/ar933x_uart.c | 24 ++++++++----------------
32 1 file changed, 8 insertions(+), 16 deletions(-)
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 {
42 -static inline bool ar933x_uart_console_enabled(void)
44 - return IS_ENABLED(CONFIG_SERIAL_AR933X_CONSOLE);
47 static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up,
50 @@ -508,6 +503,7 @@ static int ar933x_uart_verify_port(struct uart_port *port,
51 .verify_port = ar933x_uart_verify_port,
54 +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
55 static struct ar933x_uart_port *
56 ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS];
58 @@ -604,14 +600,7 @@ static int ar933x_uart_console_setup(struct console *co, char *options)
60 .data = &ar933x_uart_driver,
63 -static void ar933x_uart_add_console_port(struct ar933x_uart_port *up)
65 - if (!ar933x_uart_console_enabled())
68 - ar933x_console_ports[up->port.line] = up;
70 +#endif /* CONFIG_SERIAL_AR933X_CONSOLE */
72 static struct uart_driver ar933x_uart_driver = {
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);
78 - ar933x_uart_add_console_port(up);
79 +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
80 + ar933x_console_ports[up->port.line] = up;
83 ret = uart_add_one_port(&ar933x_uart_driver, &up->port);
85 @@ -749,8 +740,9 @@ static int __init ar933x_uart_init(void)
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;
95 ret = uart_register_driver(&ar933x_uart_driver);