Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[firefly-linux-kernel-4.4.55.git] / drivers / rtc / rtc-mv.c
index 8f87fec27ce78ffa9c191bf104cb9326368f88fc..baab802f2153c27ee3b1358b79871e4d7f5e2a2f 100644 (file)
@@ -217,7 +217,7 @@ static const struct rtc_class_ops mv_rtc_alarm_ops = {
        .alarm_irq_enable = mv_rtc_alarm_irq_enable,
 };
 
-static int mv_rtc_probe(struct platform_device *pdev)
+static int __init mv_rtc_probe(struct platform_device *pdev)
 {
        struct resource *res;
        struct rtc_plat_data *pdata;
@@ -272,12 +272,13 @@ static int mv_rtc_probe(struct platform_device *pdev)
 
        if (pdata->irq >= 0) {
                device_init_wakeup(&pdev->dev, 1);
-               pdata->rtc = rtc_device_register(pdev->name, &pdev->dev,
+               pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
                                                 &mv_rtc_alarm_ops,
                                                 THIS_MODULE);
-       } else
-               pdata->rtc = rtc_device_register(pdev->name, &pdev->dev,
+       } else {
+               pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
                                                 &mv_rtc_ops, THIS_MODULE);
+       }
        if (IS_ERR(pdata->rtc)) {
                ret = PTR_ERR(pdata->rtc);
                goto out;
@@ -308,7 +309,6 @@ static int __exit mv_rtc_remove(struct platform_device *pdev)
        if (pdata->irq >= 0)
                device_init_wakeup(&pdev->dev, 0);
 
-       rtc_device_unregister(pdata->rtc);
        if (!IS_ERR(pdata->clk))
                clk_disable_unprepare(pdata->clk);
 
@@ -331,18 +331,7 @@ static struct platform_driver mv_rtc_driver = {
        },
 };
 
-static __init int mv_init(void)
-{
-       return platform_driver_probe(&mv_rtc_driver, mv_rtc_probe);
-}
-
-static __exit void mv_exit(void)
-{
-       platform_driver_unregister(&mv_rtc_driver);
-}
-
-module_init(mv_init);
-module_exit(mv_exit);
+module_platform_driver_probe(mv_rtc_driver, mv_rtc_probe);
 
 MODULE_AUTHOR("Saeed Bishara <saeed@marvell.com>");
 MODULE_DESCRIPTION("Marvell RTC driver");