diff options
Diffstat (limited to 'drivers/serial/sunsu.c')
-rw-r--r-- | drivers/serial/sunsu.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index e074943feff5..4e2302d43ab1 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -1528,14 +1528,12 @@ static struct of_platform_driver su_driver = { | |||
1528 | .remove = __devexit_p(su_remove), | 1528 | .remove = __devexit_p(su_remove), |
1529 | }; | 1529 | }; |
1530 | 1530 | ||
1531 | static int num_uart; | ||
1532 | |||
1533 | static int __init sunsu_init(void) | 1531 | static int __init sunsu_init(void) |
1534 | { | 1532 | { |
1535 | struct device_node *dp; | 1533 | struct device_node *dp; |
1536 | int err; | 1534 | int err; |
1535 | int num_uart = 0; | ||
1537 | 1536 | ||
1538 | num_uart = 0; | ||
1539 | for_each_node_by_name(dp, "su") { | 1537 | for_each_node_by_name(dp, "su") { |
1540 | if (su_get_type(dp) == SU_PORT_PORT) | 1538 | if (su_get_type(dp) == SU_PORT_PORT) |
1541 | num_uart++; | 1539 | num_uart++; |
@@ -1552,26 +1550,22 @@ static int __init sunsu_init(void) | |||
1552 | } | 1550 | } |
1553 | 1551 | ||
1554 | if (num_uart) { | 1552 | if (num_uart) { |
1555 | sunsu_reg.minor = sunserial_current_minor; | 1553 | err = sunserial_register_minors(&sunsu_reg, num_uart); |
1556 | sunsu_reg.nr = num_uart; | ||
1557 | err = uart_register_driver(&sunsu_reg); | ||
1558 | if (err) | 1554 | if (err) |
1559 | return err; | 1555 | return err; |
1560 | sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64; | ||
1561 | sunserial_current_minor += num_uart; | ||
1562 | } | 1556 | } |
1563 | 1557 | ||
1564 | err = of_register_driver(&su_driver, &of_bus_type); | 1558 | err = of_register_driver(&su_driver, &of_bus_type); |
1565 | if (err && num_uart) | 1559 | if (err && num_uart) |
1566 | uart_unregister_driver(&sunsu_reg); | 1560 | sunserial_unregister_minors(&sunsu_reg, num_uart); |
1567 | 1561 | ||
1568 | return err; | 1562 | return err; |
1569 | } | 1563 | } |
1570 | 1564 | ||
1571 | static void __exit sunsu_exit(void) | 1565 | static void __exit sunsu_exit(void) |
1572 | { | 1566 | { |
1573 | if (num_uart) | 1567 | if (sunsu_reg.nr) |
1574 | uart_unregister_driver(&sunsu_reg); | 1568 | sunserial_unregister_minors(&sunsu_reg, sunsu_reg.nr); |
1575 | } | 1569 | } |
1576 | 1570 | ||
1577 | module_init(sunsu_init); | 1571 | module_init(sunsu_init); |