Commit 369a30a5 authored by Baolin Wang's avatar Baolin Wang Committed by Alexandre Belloni

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: default avatarBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 85368bb9
...@@ -600,6 +600,10 @@ static int sprd_rtc_probe(struct platform_device *pdev) ...@@ -600,6 +600,10 @@ static int sprd_rtc_probe(struct platform_device *pdev)
return rtc->irq; 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; rtc->dev = &pdev->dev;
platform_set_drvdata(pdev, rtc); platform_set_drvdata(pdev, rtc);
...@@ -626,10 +630,12 @@ static int sprd_rtc_probe(struct platform_device *pdev) ...@@ -626,10 +630,12 @@ static int sprd_rtc_probe(struct platform_device *pdev)
return ret; return ret;
} }
rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, rtc->rtc->ops = &sprd_rtc_ops;
&sprd_rtc_ops, THIS_MODULE); ret = rtc_register_device(rtc->rtc);
if (IS_ERR(rtc->rtc)) if (ret) {
return PTR_ERR(rtc->rtc); dev_err(&pdev->dev, "failed to register rtc device\n");
return ret;
}
device_init_wakeup(&pdev->dev, 1); device_init_wakeup(&pdev->dev, 1);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment