aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-mv.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2019-03-15 14:35:09 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-04-04 10:06:41 +0200
commit5b25a71b68eb9fcdc1c99447fdc4ee3c1d23a64f (patch)
tree05ecbdb805686aec5596fe5af516660796c5d40f /drivers/rtc/rtc-mv.c
parentrtc: mv: convert to SPDX identifier (diff)
downloadlinux-dev-5b25a71b68eb9fcdc1c99447fdc4ee3c1d23a64f.tar.xz
linux-dev-5b25a71b68eb9fcdc1c99447fdc4ee3c1d23a64f.zip
rtc: mv: convert to devm_rtc_allocate_device
This allows further improvement of the driver. Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-mv.c')
-rw-r--r--drivers/rtc/rtc-mv.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index 1e8451763832..7c0cf532a18d 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -254,15 +254,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, pdata);
- if (pdata->irq >= 0) {
- device_init_wakeup(&pdev->dev, 1);
- pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
- &mv_rtc_alarm_ops,
- THIS_MODULE);
- } else {
- pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
- &mv_rtc_ops, THIS_MODULE);
- }
+ pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(pdata->rtc)) {
ret = PTR_ERR(pdata->rtc);
goto out;
@@ -278,7 +270,16 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
}
}
- return 0;
+ if (pdata->irq >= 0) {
+ device_init_wakeup(&pdev->dev, 1);
+ pdata->rtc->ops = &mv_rtc_alarm_ops;
+ } else {
+ pdata->rtc->ops = &mv_rtc_ops;
+ }
+
+ ret = rtc_register_device(pdata->rtc);
+ if (!ret)
+ return 0;
out:
if (!IS_ERR(pdata->clk))
clk_disable_unprepare(pdata->clk);