diff options
Diffstat (limited to 'drivers/tty/serial/ar933x_uart.c')
-rw-r--r-- | drivers/tty/serial/ar933x_uart.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c index 2d83a45dcc8d..0437a9e08d58 100644 --- a/drivers/tty/serial/ar933x_uart.c +++ b/drivers/tty/serial/ar933x_uart.c | |||
@@ -50,6 +50,11 @@ struct ar933x_uart_port { | |||
50 | struct clk *clk; | 50 | struct clk *clk; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | static inline bool ar933x_uart_console_enabled(void) | ||
54 | { | ||
55 | return config_enabled(CONFIG_SERIAL_AR933X_CONSOLE); | ||
56 | } | ||
57 | |||
53 | static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up, | 58 | static inline unsigned int ar933x_uart_read(struct ar933x_uart_port *up, |
54 | int offset) | 59 | int offset) |
55 | { | 60 | { |
@@ -500,8 +505,6 @@ static struct uart_ops ar933x_uart_ops = { | |||
500 | .verify_port = ar933x_uart_verify_port, | 505 | .verify_port = ar933x_uart_verify_port, |
501 | }; | 506 | }; |
502 | 507 | ||
503 | #ifdef CONFIG_SERIAL_AR933X_CONSOLE | ||
504 | |||
505 | static struct ar933x_uart_port * | 508 | static struct ar933x_uart_port * |
506 | ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS]; | 509 | ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS]; |
507 | 510 | ||
@@ -600,25 +603,18 @@ static struct console ar933x_uart_console = { | |||
600 | 603 | ||
601 | static void ar933x_uart_add_console_port(struct ar933x_uart_port *up) | 604 | static void ar933x_uart_add_console_port(struct ar933x_uart_port *up) |
602 | { | 605 | { |
606 | if (!ar933x_uart_console_enabled()) | ||
607 | return; | ||
608 | |||
603 | ar933x_console_ports[up->port.line] = up; | 609 | ar933x_console_ports[up->port.line] = up; |
604 | } | 610 | } |
605 | 611 | ||
606 | #define AR933X_SERIAL_CONSOLE (&ar933x_uart_console) | ||
607 | |||
608 | #else | ||
609 | |||
610 | static inline void ar933x_uart_add_console_port(struct ar933x_uart_port *up) {} | ||
611 | |||
612 | #define AR933X_SERIAL_CONSOLE NULL | ||
613 | |||
614 | #endif /* CONFIG_SERIAL_AR933X_CONSOLE */ | ||
615 | |||
616 | static struct uart_driver ar933x_uart_driver = { | 612 | static struct uart_driver ar933x_uart_driver = { |
617 | .owner = THIS_MODULE, | 613 | .owner = THIS_MODULE, |
618 | .driver_name = DRIVER_NAME, | 614 | .driver_name = DRIVER_NAME, |
619 | .dev_name = "ttyATH", | 615 | .dev_name = "ttyATH", |
620 | .nr = CONFIG_SERIAL_AR933X_NR_UARTS, | 616 | .nr = CONFIG_SERIAL_AR933X_NR_UARTS, |
621 | .cons = AR933X_SERIAL_CONSOLE, | 617 | .cons = NULL, /* filled in runtime */ |
622 | }; | 618 | }; |
623 | 619 | ||
624 | static int ar933x_uart_probe(struct platform_device *pdev) | 620 | static int ar933x_uart_probe(struct platform_device *pdev) |
@@ -730,6 +726,9 @@ static int __init ar933x_uart_init(void) | |||
730 | { | 726 | { |
731 | int ret; | 727 | int ret; |
732 | 728 | ||
729 | if (ar933x_uart_console_enabled()) | ||
730 | ar933x_uart_driver.cons = &ar933x_uart_console; | ||
731 | |||
733 | ret = uart_register_driver(&ar933x_uart_driver); | 732 | ret = uart_register_driver(&ar933x_uart_driver); |
734 | if (ret) | 733 | if (ret) |
735 | goto err_out; | 734 | goto err_out; |