aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunzilog.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-02-13 23:09:10 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-20 04:12:42 -0500
commit1ddb7c98d44b898cfe0443c1e242cebfb0479d46 (patch)
tree995bd63451677335e59d981c57e7369238afecb4 /drivers/serial/sunzilog.c
parent10951ee61056a9f91c00c16746f2042672d7af7c (diff)
[SPARC64]: Prevent registering wrong serial console.
If the console is not for a particular Sun serial controller, set the drv->cons to NULL. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/serial/sunzilog.c')
-rw-r--r--drivers/serial/sunzilog.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 5cc4d4c2935c..5aa74e7a954e 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1390,7 +1390,6 @@ static struct console sunzilog_console = {
1390 .index = -1, 1390 .index = -1,
1391 .data = &sunzilog_reg, 1391 .data = &sunzilog_reg,
1392}; 1392};
1393#define SUNZILOG_CONSOLE (&sunzilog_console)
1394 1393
1395static int __init sunzilog_console_init(void) 1394static int __init sunzilog_console_init(void)
1396{ 1395{
@@ -1413,8 +1412,31 @@ static int __init sunzilog_console_init(void)
1413 register_console(&sunzilog_console); 1412 register_console(&sunzilog_console);
1414 return 0; 1413 return 0;
1415} 1414}
1415
1416static inline struct console *SUNZILOG_CONSOLE(void)
1417{
1418 int i;
1419
1420 if (con_is_present())
1421 return NULL;
1422
1423 for (i = 0; i < NUM_CHANNELS; i++) {
1424 int this_minor = sunzilog_reg.minor + i;
1425
1426 if ((this_minor - 64) == (serial_console - 1))
1427 break;
1428 }
1429 if (i == NUM_CHANNELS)
1430 return NULL;
1431
1432 sunzilog_console.index = i;
1433 sunzilog_port_table[i].flags |= SUNZILOG_FLAG_IS_CONS;
1434
1435 return &sunzilog_console;
1436}
1437
1416#else 1438#else
1417#define SUNZILOG_CONSOLE (NULL) 1439#define SUNZILOG_CONSOLE() (NULL)
1418#define sunzilog_console_init() do { } while (0) 1440#define sunzilog_console_init() do { } while (0)
1419#endif 1441#endif
1420 1442
@@ -1666,14 +1688,14 @@ static int __init sunzilog_ports_init(void)
1666 } 1688 }
1667 1689
1668 sunzilog_reg.nr = uart_count; 1690 sunzilog_reg.nr = uart_count;
1669 sunzilog_reg.cons = SUNZILOG_CONSOLE;
1670
1671 sunzilog_reg.minor = sunserial_current_minor; 1691 sunzilog_reg.minor = sunserial_current_minor;
1672 sunserial_current_minor += uart_count;
1673 1692
1674 ret = uart_register_driver(&sunzilog_reg); 1693 ret = uart_register_driver(&sunzilog_reg);
1675 if (ret == 0) { 1694 if (ret == 0) {
1676 sunzilog_console_init(); 1695 sunzilog_reg.cons = SUNZILOG_CONSOLE();
1696
1697 sunserial_current_minor += uart_count;
1698
1677 for (i = 0; i < NUM_CHANNELS; i++) { 1699 for (i = 0; i < NUM_CHANNELS; i++) {
1678 struct uart_sunzilog_port *up = &sunzilog_port_table[i]; 1700 struct uart_sunzilog_port *up = &sunzilog_port_table[i];
1679 1701