rtc: jz4740: set range
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 30 Apr 2019 09:28:15 +0000 (11:28 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 30 Apr 2019 09:50:11 +0000 (11:50 +0200)
RTC_SEC is a 32-bit seconds counter.

Tested-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-jz4740.c

index d0a891777f442b41981e22de3d1021ce5d7a66a9..079469627bd76aa229eed1ae457773a55371442a 100644 (file)
@@ -348,10 +348,18 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
 
        device_init_wakeup(&pdev->dev, 1);
 
-       rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-                                       &jz4740_rtc_ops, THIS_MODULE);
+       rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
        if (IS_ERR(rtc->rtc)) {
                ret = PTR_ERR(rtc->rtc);
+               dev_err(&pdev->dev, "Failed to allocate rtc device: %d\n", ret);
+               return ret;
+       }
+
+       rtc->rtc->ops = &jz4740_rtc_ops;
+       rtc->rtc->range_max = U32_MAX;
+
+       ret = rtc_register_device(rtc->rtc);
+       if (ret) {
                dev_err(&pdev->dev, "Failed to register rtc device: %d\n", ret);
                return ret;
        }