rtc: goldfish: convert to devm_rtc_allocate_device
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 20 Mar 2019 12:34:12 +0000 (13:34 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 4 Apr 2019 08:07:08 +0000 (10:07 +0200)
This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-goldfish.c

index a1c44d0c855780f8ba109e79c6bd62cb96dbb40d..d4cb33f209fbc13b5061fd039c56c5d71e1ba716 100644 (file)
@@ -205,19 +205,19 @@ static int goldfish_rtc_probe(struct platform_device *pdev)
        if (rtcdrv->irq < 0)
                return -ENODEV;
 
-       rtcdrv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-                                              &goldfish_rtc_ops,
-                                              THIS_MODULE);
+       rtcdrv->rtc = devm_rtc_allocate_device(&pdev->dev);
        if (IS_ERR(rtcdrv->rtc))
                return PTR_ERR(rtcdrv->rtc);
 
+       rtcdrv->rtc->ops = &goldfish_rtc_ops;
+
        err = devm_request_irq(&pdev->dev, rtcdrv->irq,
                               goldfish_rtc_interrupt,
                               0, pdev->name, rtcdrv);
        if (err)
                return err;
 
-       return 0;
+       return rtc_register_device(rtcdrv->rtc);
 }
 
 static const struct of_device_id goldfish_rtc_of_match[] = {