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 --- a/drivers/tty/serial/ar933x_uart.c
35 +++ b/drivers/tty/serial/ar933x_uart.c
36 @@ -52,11 +52,6 @@ struct ar933x_uart_port {
40 -static inline bool ar933x_uart_console_enabled(void)
42 - return IS_ENABLED(CONFIG_SERIAL_AR933X_CONSOLE);
45 static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up,
48 @@ -511,6 +506,7 @@ static const struct uart_ops ar933x_uart
49 .verify_port = ar933x_uart_verify_port,
52 +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
53 static struct ar933x_uart_port *
54 ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS];
56 @@ -607,14 +603,7 @@ static struct console ar933x_uart_consol
58 .data = &ar933x_uart_driver,
61 -static void ar933x_uart_add_console_port(struct ar933x_uart_port *up)
63 - if (!ar933x_uart_console_enabled())
66 - ar933x_console_ports[up->port.line] = up;
68 +#endif /* CONFIG_SERIAL_AR933X_CONSOLE */
70 static struct uart_driver ar933x_uart_driver = {
72 @@ -703,7 +692,9 @@ static int ar933x_uart_probe(struct plat
73 baud = ar933x_uart_get_baud(port->uartclk, 0, AR933X_UART_MAX_STEP);
74 up->max_baud = min_t(unsigned int, baud, AR933X_UART_MAX_BAUD);
76 - ar933x_uart_add_console_port(up);
77 +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
78 + ar933x_console_ports[up->port.line] = up;
81 ret = uart_add_one_port(&ar933x_uart_driver, &up->port);
83 @@ -752,8 +743,9 @@ static int __init ar933x_uart_init(void)
87 - if (ar933x_uart_console_enabled())
88 - ar933x_uart_driver.cons = &ar933x_uart_console;
89 +#ifdef CONFIG_SERIAL_AR933X_CONSOLE
90 + ar933x_uart_driver.cons = &ar933x_uart_console;
93 ret = uart_register_driver(&ar933x_uart_driver);