aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-sc27xx.c
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2018-04-26 10:58:44 +0800
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-05-03 22:11:49 +0200
commit369a30a5f1c9245a214155ee527fa169e7f813ff (patch)
treeae4bdde45bd23efd36fac5b9c2d0622943034bb3 /drivers/rtc/rtc-sc27xx.c
parent85368bb9de6366654f442e26fdd571981f205291 (diff)
downloadlinux-369a30a5f1c9245a214155ee527fa169e7f813ff.tar.gz
rtc: sprd: Change to use devm_rtc_allocate_device()
This is a preparation patch, changing to use devm_rtc_allocate_device() that can allow driver to set 'range_max' and 'range_min' for the RTC device. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-sc27xx.c')
-rw-r--r--drivers/rtc/rtc-sc27xx.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c
index 00d87d138984b..ac86322c72bc5 100644
--- a/drivers/rtc/rtc-sc27xx.c
+++ b/drivers/rtc/rtc-sc27xx.c
@@ -600,6 +600,10 @@ static int sprd_rtc_probe(struct platform_device *pdev)
return rtc->irq;
}
+ rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(rtc->rtc))
+ return PTR_ERR(rtc->rtc);
+
rtc->dev = &pdev->dev;
platform_set_drvdata(pdev, rtc);
@@ -626,10 +630,12 @@ static int sprd_rtc_probe(struct platform_device *pdev)
return ret;
}
- rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
- &sprd_rtc_ops, THIS_MODULE);
- if (IS_ERR(rtc->rtc))
- return PTR_ERR(rtc->rtc);
+ rtc->rtc->ops = &sprd_rtc_ops;
+ ret = rtc_register_device(rtc->rtc);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to register rtc device\n");
+ return ret;
+ }
device_init_wakeup(&pdev->dev, 1);
return 0;