diff options
Diffstat (limited to 'drivers/serial/sunsab.c')
-rw-r--r-- | drivers/serial/sunsab.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index ff610c23314b..543f93741e6f 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -832,7 +832,6 @@ static struct uart_driver sunsab_reg = { | |||
832 | }; | 832 | }; |
833 | 833 | ||
834 | static struct uart_sunsab_port *sunsab_ports; | 834 | static struct uart_sunsab_port *sunsab_ports; |
835 | static int num_channels; | ||
836 | 835 | ||
837 | #ifdef CONFIG_SERIAL_SUNSAB_CONSOLE | 836 | #ifdef CONFIG_SERIAL_SUNSAB_CONSOLE |
838 | 837 | ||
@@ -1102,8 +1101,8 @@ static int __init sunsab_init(void) | |||
1102 | { | 1101 | { |
1103 | struct device_node *dp; | 1102 | struct device_node *dp; |
1104 | int err; | 1103 | int err; |
1104 | int num_channels = 0; | ||
1105 | 1105 | ||
1106 | num_channels = 0; | ||
1107 | for_each_node_by_name(dp, "se") | 1106 | for_each_node_by_name(dp, "se") |
1108 | num_channels += 2; | 1107 | num_channels += 2; |
1109 | for_each_node_by_name(dp, "serial") { | 1108 | for_each_node_by_name(dp, "serial") { |
@@ -1117,20 +1116,14 @@ static int __init sunsab_init(void) | |||
1117 | if (!sunsab_ports) | 1116 | if (!sunsab_ports) |
1118 | return -ENOMEM; | 1117 | return -ENOMEM; |
1119 | 1118 | ||
1120 | sunsab_reg.minor = sunserial_current_minor; | ||
1121 | sunsab_reg.nr = num_channels; | ||
1122 | sunsab_reg.cons = SUNSAB_CONSOLE(); | 1119 | sunsab_reg.cons = SUNSAB_CONSOLE(); |
1123 | 1120 | err = sunserial_register_minors(&sunsab_reg, num_channels); | |
1124 | err = uart_register_driver(&sunsab_reg); | ||
1125 | if (err) { | 1121 | if (err) { |
1126 | kfree(sunsab_ports); | 1122 | kfree(sunsab_ports); |
1127 | sunsab_ports = NULL; | 1123 | sunsab_ports = NULL; |
1128 | 1124 | ||
1129 | return err; | 1125 | return err; |
1130 | } | 1126 | } |
1131 | |||
1132 | sunsab_reg.tty_driver->name_base = sunsab_reg.minor - 64; | ||
1133 | sunserial_current_minor += num_channels; | ||
1134 | } | 1127 | } |
1135 | 1128 | ||
1136 | return of_register_driver(&sab_driver, &of_bus_type); | 1129 | return of_register_driver(&sab_driver, &of_bus_type); |
@@ -1139,9 +1132,8 @@ static int __init sunsab_init(void) | |||
1139 | static void __exit sunsab_exit(void) | 1132 | static void __exit sunsab_exit(void) |
1140 | { | 1133 | { |
1141 | of_unregister_driver(&sab_driver); | 1134 | of_unregister_driver(&sab_driver); |
1142 | if (num_channels) { | 1135 | if (sunsab_reg.nr) { |
1143 | sunserial_current_minor -= num_channels; | 1136 | sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr); |
1144 | uart_unregister_driver(&sunsab_reg); | ||
1145 | } | 1137 | } |
1146 | 1138 | ||
1147 | kfree(sunsab_ports); | 1139 | kfree(sunsab_ports); |