aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunzilog.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/sunzilog.c')
-rw-r--r--drivers/serial/sunzilog.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index b0c46b9a5930..cd49ebbf4a45 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1385,7 +1385,6 @@ static struct console sunzilog_console = {
1385 .index = -1, 1385 .index = -1,
1386 .data = &sunzilog_reg, 1386 .data = &sunzilog_reg,
1387}; 1387};
1388#define SUNZILOG_CONSOLE (&sunzilog_console)
1389 1388
1390static int __init sunzilog_console_init(void) 1389static int __init sunzilog_console_init(void)
1391{ 1390{
@@ -1408,8 +1407,31 @@ static int __init sunzilog_console_init(void)
1408 register_console(&sunzilog_console); 1407 register_console(&sunzilog_console);
1409 return 0; 1408 return 0;
1410} 1409}
1410
1411static inline struct console *SUNZILOG_CONSOLE(void)
1412{
1413 int i;
1414
1415 if (con_is_present())
1416 return NULL;
1417
1418 for (i = 0; i < NUM_CHANNELS; i++) {
1419 int this_minor = sunzilog_reg.minor + i;
1420
1421 if ((this_minor - 64) == (serial_console - 1))
1422 break;
1423 }
1424 if (i == NUM_CHANNELS)
1425 return NULL;
1426
1427 sunzilog_console.index = i;
1428 sunzilog_port_table[i].flags |= SUNZILOG_FLAG_IS_CONS;
1429
1430 return &sunzilog_console;
1431}
1432
1411#else 1433#else
1412#define SUNZILOG_CONSOLE (NULL) 1434#define SUNZILOG_CONSOLE() (NULL)
1413#define sunzilog_console_init() do { } while (0) 1435#define sunzilog_console_init() do { } while (0)
1414#endif 1436#endif
1415 1437
@@ -1661,14 +1683,15 @@ static int __init sunzilog_ports_init(void)
1661 } 1683 }
1662 1684
1663 sunzilog_reg.nr = uart_count; 1685 sunzilog_reg.nr = uart_count;
1664 sunzilog_reg.cons = SUNZILOG_CONSOLE;
1665
1666 sunzilog_reg.minor = sunserial_current_minor; 1686 sunzilog_reg.minor = sunserial_current_minor;
1667 sunserial_current_minor += uart_count;
1668 1687
1669 ret = uart_register_driver(&sunzilog_reg); 1688 ret = uart_register_driver(&sunzilog_reg);
1670 if (ret == 0) { 1689 if (ret == 0) {
1671 sunzilog_console_init(); 1690 sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64;
1691 sunzilog_reg.cons = SUNZILOG_CONSOLE();
1692
1693 sunserial_current_minor += uart_count;
1694
1672 for (i = 0; i < NUM_CHANNELS; i++) { 1695 for (i = 0; i < NUM_CHANNELS; i++) {
1673 struct uart_sunzilog_port *up = &sunzilog_port_table[i]; 1696 struct uart_sunzilog_port *up = &sunzilog_port_table[i];
1674 1697