diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-02-13 23:09:10 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:12:42 -0500 |
commit | 1ddb7c98d44b898cfe0443c1e242cebfb0479d46 (patch) | |
tree | 995bd63451677335e59d981c57e7369238afecb4 /drivers/serial/sunsab.c | |
parent | 10951ee61056a9f91c00c16746f2042672d7af7c (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/sunsab.c')
-rw-r--r-- | drivers/serial/sunsab.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index 85664228a0b6..02f62da546b5 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -955,14 +955,13 @@ static struct console sunsab_console = { | |||
955 | .index = -1, | 955 | .index = -1, |
956 | .data = &sunsab_reg, | 956 | .data = &sunsab_reg, |
957 | }; | 957 | }; |
958 | #define SUNSAB_CONSOLE (&sunsab_console) | ||
959 | 958 | ||
960 | static void __init sunsab_console_init(void) | 959 | static inline struct console *SUNSAB_CONSOLE(void) |
961 | { | 960 | { |
962 | int i; | 961 | int i; |
963 | 962 | ||
964 | if (con_is_present()) | 963 | if (con_is_present()) |
965 | return; | 964 | return NULL; |
966 | 965 | ||
967 | for (i = 0; i < num_channels; i++) { | 966 | for (i = 0; i < num_channels; i++) { |
968 | int this_minor = sunsab_reg.minor + i; | 967 | int this_minor = sunsab_reg.minor + i; |
@@ -971,13 +970,14 @@ static void __init sunsab_console_init(void) | |||
971 | break; | 970 | break; |
972 | } | 971 | } |
973 | if (i == num_channels) | 972 | if (i == num_channels) |
974 | return; | 973 | return NULL; |
975 | 974 | ||
976 | sunsab_console.index = i; | 975 | sunsab_console.index = i; |
977 | register_console(&sunsab_console); | 976 | |
977 | return &sunsab_console; | ||
978 | } | 978 | } |
979 | #else | 979 | #else |
980 | #define SUNSAB_CONSOLE (NULL) | 980 | #define SUNSAB_CONSOLE() (NULL) |
981 | #define sunsab_console_init() do { } while (0) | 981 | #define sunsab_console_init() do { } while (0) |
982 | #endif | 982 | #endif |
983 | 983 | ||
@@ -1124,7 +1124,6 @@ static int __init sunsab_init(void) | |||
1124 | 1124 | ||
1125 | sunsab_reg.minor = sunserial_current_minor; | 1125 | sunsab_reg.minor = sunserial_current_minor; |
1126 | sunsab_reg.nr = num_channels; | 1126 | sunsab_reg.nr = num_channels; |
1127 | sunsab_reg.cons = SUNSAB_CONSOLE; | ||
1128 | 1127 | ||
1129 | ret = uart_register_driver(&sunsab_reg); | 1128 | ret = uart_register_driver(&sunsab_reg); |
1130 | if (ret < 0) { | 1129 | if (ret < 0) { |
@@ -1143,10 +1142,10 @@ static int __init sunsab_init(void) | |||
1143 | return ret; | 1142 | return ret; |
1144 | } | 1143 | } |
1145 | 1144 | ||
1145 | sunsab_reg.cons = SUNSAB_CONSOLE(); | ||
1146 | |||
1146 | sunserial_current_minor += num_channels; | 1147 | sunserial_current_minor += num_channels; |
1147 | 1148 | ||
1148 | sunsab_console_init(); | ||
1149 | |||
1150 | for (i = 0; i < num_channels; i++) { | 1149 | for (i = 0; i < num_channels; i++) { |
1151 | struct uart_sunsab_port *up = &sunsab_ports[i]; | 1150 | struct uart_sunsab_port *up = &sunsab_ports[i]; |
1152 | 1151 | ||