Skip to content

Commit 10a0ba2

Browse files
ynezzgregkh
authored andcommitted
serial: ar933x_uart: Fix build failure with disabled console
[ Upstream commit 72ff51d ] Andrey has reported on OpenWrt's bug tracking system[1], that he currently can't use ar93xx_uart as pure serial UART without console (CONFIG_SERIAL_8250_CONSOLE and CONFIG_SERIAL_AR933X_CONSOLE undefined), because compilation ends with following error: ar933x_uart.c: In function 'ar933x_uart_console_write': ar933x_uart.c:550:14: error: 'struct uart_port' has no member named 'sysrq' So this patch moves all the code related to console handling behind series of CONFIG_SERIAL_AR933X_CONSOLE ifdefs. 1. https://bugs.openwrt.org/index.php?do=details&task_id=2152 Cc: Greg Kroah-Hartman <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Andrey Batyiev <[email protected]> Reported-by: Andrey Batyiev <[email protected]> Tested-by: Andrey Batyiev <[email protected]> Signed-off-by: Petr Štetiar <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Sasha Levin (Microsoft) <[email protected]>
1 parent 707615f commit 10a0ba2

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

drivers/tty/serial/ar933x_uart.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ struct ar933x_uart_port {
5252
struct clk *clk;
5353
};
5454

55-
static inline bool ar933x_uart_console_enabled(void)
56-
{
57-
return IS_ENABLED(CONFIG_SERIAL_AR933X_CONSOLE);
58-
}
59-
6055
static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up,
6156
int offset)
6257
{
@@ -511,6 +506,7 @@ static const struct uart_ops ar933x_uart_ops = {
511506
.verify_port = ar933x_uart_verify_port,
512507
};
513508

509+
#ifdef CONFIG_SERIAL_AR933X_CONSOLE
514510
static struct ar933x_uart_port *
515511
ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS];
516512

@@ -607,14 +603,7 @@ static struct console ar933x_uart_console = {
607603
.index = -1,
608604
.data = &ar933x_uart_driver,
609605
};
610-
611-
static void ar933x_uart_add_console_port(struct ar933x_uart_port *up)
612-
{
613-
if (!ar933x_uart_console_enabled())
614-
return;
615-
616-
ar933x_console_ports[up->port.line] = up;
617-
}
606+
#endif /* CONFIG_SERIAL_AR933X_CONSOLE */
618607

619608
static struct uart_driver ar933x_uart_driver = {
620609
.owner = THIS_MODULE,
@@ -703,7 +692,9 @@ static int ar933x_uart_probe(struct platform_device *pdev)
703692
baud = ar933x_uart_get_baud(port->uartclk, 0, AR933X_UART_MAX_STEP);
704693
up->max_baud = min_t(unsigned int, baud, AR933X_UART_MAX_BAUD);
705694

706-
ar933x_uart_add_console_port(up);
695+
#ifdef CONFIG_SERIAL_AR933X_CONSOLE
696+
ar933x_console_ports[up->port.line] = up;
697+
#endif
707698

708699
ret = uart_add_one_port(&ar933x_uart_driver, &up->port);
709700
if (ret)
@@ -752,8 +743,9 @@ static int __init ar933x_uart_init(void)
752743
{
753744
int ret;
754745

755-
if (ar933x_uart_console_enabled())
756-
ar933x_uart_driver.cons = &ar933x_uart_console;
746+
#ifdef CONFIG_SERIAL_AR933X_CONSOLE
747+
ar933x_uart_driver.cons = &ar933x_uart_console;
748+
#endif
757749

758750
ret = uart_register_driver(&ar933x_uart_driver);
759751
if (ret)

0 commit comments

Comments
 (0)