summaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunsab.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-02-13 20:09:10 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-20 01:12:42 -0800
commit1ddb7c98d44b898cfe0443c1e242cebfb0479d46 (patch)
tree995bd63451677335e59d981c57e7369238afecb4 /drivers/serial/sunsab.c
parent10951ee61056a9f91c00c16746f2042672d7af7c (diff)
downloadop-kernel-dev-1ddb7c98d44b898cfe0443c1e242cebfb0479d46.zip
op-kernel-dev-1ddb7c98d44b898cfe0443c1e242cebfb0479d46.tar.gz
[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/sunsab.c')
-rw-r--r--drivers/serial/sunsab.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 8566422..02f62da 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -955,14 +955,13 @@ static struct console sunsab_console = {
.index = -1,
.data = &sunsab_reg,
};
-#define SUNSAB_CONSOLE (&sunsab_console)
-static void __init sunsab_console_init(void)
+static inline struct console *SUNSAB_CONSOLE(void)
{
int i;
if (con_is_present())
- return;
+ return NULL;
for (i = 0; i < num_channels; i++) {
int this_minor = sunsab_reg.minor + i;
@@ -971,13 +970,14 @@ static void __init sunsab_console_init(void)
break;
}
if (i == num_channels)
- return;
+ return NULL;
sunsab_console.index = i;
- register_console(&sunsab_console);
+
+ return &sunsab_console;
}
#else
-#define SUNSAB_CONSOLE (NULL)
+#define SUNSAB_CONSOLE() (NULL)
#define sunsab_console_init() do { } while (0)
#endif
@@ -1124,7 +1124,6 @@ static int __init sunsab_init(void)
sunsab_reg.minor = sunserial_current_minor;
sunsab_reg.nr = num_channels;
- sunsab_reg.cons = SUNSAB_CONSOLE;
ret = uart_register_driver(&sunsab_reg);
if (ret < 0) {
@@ -1143,10 +1142,10 @@ static int __init sunsab_init(void)
return ret;
}
+ sunsab_reg.cons = SUNSAB_CONSOLE();
+
sunserial_current_minor += num_channels;
- sunsab_console_init();
-
for (i = 0; i < num_channels; i++) {
struct uart_sunsab_port *up = &sunsab_ports[i];
OpenPOWER on IntegriCloud