summaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunsu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/sunsu.c')
-rw-r--r--drivers/serial/sunsu.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index e074943feff..4e2302d43ab 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1528,14 +1528,12 @@ static struct of_platform_driver su_driver = {
.remove = __devexit_p(su_remove),
};
-static int num_uart;
-
static int __init sunsu_init(void)
{
struct device_node *dp;
int err;
+ int num_uart = 0;
- num_uart = 0;
for_each_node_by_name(dp, "su") {
if (su_get_type(dp) == SU_PORT_PORT)
num_uart++;
@@ -1552,26 +1550,22 @@ static int __init sunsu_init(void)
}
if (num_uart) {
- sunsu_reg.minor = sunserial_current_minor;
- sunsu_reg.nr = num_uart;
- err = uart_register_driver(&sunsu_reg);
+ err = sunserial_register_minors(&sunsu_reg, num_uart);
if (err)
return err;
- sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64;
- sunserial_current_minor += num_uart;
}
err = of_register_driver(&su_driver, &of_bus_type);
if (err && num_uart)
- uart_unregister_driver(&sunsu_reg);
+ sunserial_unregister_minors(&sunsu_reg, num_uart);
return err;
}
static void __exit sunsu_exit(void)
{
- if (num_uart)
- uart_unregister_driver(&sunsu_reg);
+ if (sunsu_reg.nr)
+ sunserial_unregister_minors(&sunsu_reg, sunsu_reg.nr);
}
module_init(sunsu_init);