aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunsu.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/sunsu.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/sunsu.c')
-rw-r--r--drivers/serial/sunsu.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 4e453fa966ae..3313cb2a355a 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1464,18 +1464,17 @@ static struct console sunsu_cons = {
1464 .index = -1, 1464 .index = -1,
1465 .data = &sunsu_reg, 1465 .data = &sunsu_reg,
1466}; 1466};
1467#define SUNSU_CONSOLE (&sunsu_cons)
1468 1467
1469/* 1468/*
1470 * Register console. 1469 * Register console.
1471 */ 1470 */
1472 1471
1473static int __init sunsu_serial_console_init(void) 1472static inline struct console *SUNSU_CONSOLE(void)
1474{ 1473{
1475 int i; 1474 int i;
1476 1475
1477 if (con_is_present()) 1476 if (con_is_present())
1478 return 0; 1477 return NULL;
1479 1478
1480 for (i = 0; i < UART_NR; i++) { 1479 for (i = 0; i < UART_NR; i++) {
1481 int this_minor = sunsu_reg.minor + i; 1480 int this_minor = sunsu_reg.minor + i;
@@ -1484,16 +1483,16 @@ static int __init sunsu_serial_console_init(void)
1484 break; 1483 break;
1485 } 1484 }
1486 if (i == UART_NR) 1485 if (i == UART_NR)
1487 return 0; 1486 return NULL;
1488 if (sunsu_ports[i].port_node == 0) 1487 if (sunsu_ports[i].port_node == 0)
1489 return 0; 1488 return NULL;
1490 1489
1491 sunsu_cons.index = i; 1490 sunsu_cons.index = i;
1492 register_console(&sunsu_cons); 1491
1493 return 0; 1492 return &sunsu_cons;
1494} 1493}
1495#else 1494#else
1496#define SUNSU_CONSOLE (NULL) 1495#define SUNSU_CONSOLE() (NULL)
1497#define sunsu_serial_console_init() do { } while (0) 1496#define sunsu_serial_console_init() do { } while (0)
1498#endif 1497#endif
1499 1498
@@ -1523,16 +1522,17 @@ static int __init sunsu_serial_init(void)
1523 } 1522 }
1524 1523
1525 sunsu_reg.minor = sunserial_current_minor; 1524 sunsu_reg.minor = sunserial_current_minor;
1526 sunserial_current_minor += instance;
1527 1525
1528 sunsu_reg.nr = instance; 1526 sunsu_reg.nr = instance;
1529 sunsu_reg.cons = SUNSU_CONSOLE;
1530 1527
1531 ret = uart_register_driver(&sunsu_reg); 1528 ret = uart_register_driver(&sunsu_reg);
1532 if (ret < 0) 1529 if (ret < 0)
1533 return ret; 1530 return ret;
1534 1531
1535 sunsu_serial_console_init(); 1532 sunserial_current_minor += instance;
1533
1534 sunsu_reg.cons = SUNSU_CONSOLE();
1535
1536 for (i = 0; i < UART_NR; i++) { 1536 for (i = 0; i < UART_NR; i++) {
1537 struct uart_sunsu_port *up = &sunsu_ports[i]; 1537 struct uart_sunsu_port *up = &sunsu_ports[i];
1538 1538