Skip to content

Commit

Permalink
rtc: sprd: Change to use devm_rtc_allocate_device()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Baolin Wang authored and Alexandre Belloni committed May 3, 2018
1 parent 85368bb commit 369a30a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions drivers/rtc/rtc-sc27xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down

0 comments on commit 369a30a

Please sign in to comment.