rtc: au1xxx: convert to devm_rtc_allocate_device
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 6 Mar 2020 00:59:55 +0000 (01:59 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 16 Mar 2020 10:12:09 +0000 (11:12 +0100)
This allows further improvement of the driver.

Link: https://lore.kernel.org/r/20200306005958.39203-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-au1xxx.c

index 7c5530c71285bd05e429ca51c820bd21a54053c4..a13ac73aa2b746a8698932cdfd7e052f5791b274 100644 (file)
@@ -99,16 +99,15 @@ static int au1xtoy_rtc_probe(struct platform_device *pdev)
        while (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_C0S)
                msleep(1);
 
-       rtcdev = devm_rtc_device_register(&pdev->dev, "rtc-au1xxx",
-                                    &au1xtoy_rtc_ops, THIS_MODULE);
-       if (IS_ERR(rtcdev)) {
-               ret = PTR_ERR(rtcdev);
-               goto out_err;
-       }
+       rtcdev = devm_rtc_allocate_device(&pdev->dev);
+       if (IS_ERR(rtcdev))
+               return PTR_ERR(rtcdev);
+
+       rtcdev->ops = &au1xtoy_rtc_ops;
 
        platform_set_drvdata(pdev, rtcdev);
 
-       return 0;
+       return rtc_register_device(rtcdev);
 
 out_err:
        return ret;