Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: ab3100: set range

The ab3100 has a 48bit counter running at 65536 Hz (despite one of the
comment). The max value is then (2^48 - 1)/2^16 == 2^32 - 1.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

+9 -7
+9 -7
drivers/rtc/rtc-ab3100.c
··· 228 228 /* Ignore any error on this write */ 229 229 } 230 230 231 - rtc = devm_rtc_device_register(&pdev->dev, "ab3100-rtc", 232 - &ab3100_rtc_ops, THIS_MODULE); 233 - if (IS_ERR(rtc)) { 234 - err = PTR_ERR(rtc); 235 - return err; 236 - } 231 + rtc = devm_rtc_allocate_device(&pdev->dev); 232 + if (IS_ERR(rtc)) 233 + return PTR_ERR(rtc); 234 + 235 + rtc->ops = &ab3100_rtc_ops; 236 + /* 48bit counter at (AB3100_RTC_CLOCK_RATE * 2) */ 237 + rtc->range_max = U32_MAX; 238 + 237 239 platform_set_drvdata(pdev, rtc); 238 240 239 - return 0; 241 + return rtc_register_device(rtc); 240 242 } 241 243 242 244 static struct platform_driver ab3100_rtc_driver = {