[PATCH 55/59] rtc: rtd119x: stop using deprecated RTC API

Bartosz Golaszewski
2020-11-19T11:44:19Z

drivers/rtc/rtc-rtd119x.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-rtd119x.c b/drivers/rtc/rtc-rtd119x.c
index bb98f2d574a5..547ab60adb3f 100644
--- a/drivers/rtc/rtc-rtd119x.c
+++ b/drivers/rtc/rtc-rtd119x.c
@@ -205,10 +205,17 @@ static int rtd119x_rtc_probe(struct platform_device *pdev)

rtd119x_rtc_set_enabled(&pdev->dev, true);

- data->rtcdev = devm_rtc_device_register(&pdev->dev, "rtc",
- &rtd119x_rtc_ops, THIS_MODULE);
+ data->rtcdev = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(data->rtcdev)) {
- dev_err(&pdev->dev, "failed to register rtc device");
+ clk_disable_unprepare(data->clk);
+ clk_put(data->clk);
+ return PTR_ERR(data->rtcdev);
+ }
+
+ data->rtcdev->ops = &rtd119x_rtc_ops;
+
+ ret = devm_rtc_register_device(data->rtcdev);
+ if (ret) {
clk_disable_unprepare(data->clk);
clk_put(data->clk);
return PTR_ERR(data->rtcdev);
--
2.29.1