[PATCH 50/59] rtc: v3020: stop using deprecated RTC API

From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:44:12 EST


From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>

devm_rtc_device_register() is deprecated. Use devm_rtc_allocate_device()
and devm_rtc_register_device() pair instead.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
---
drivers/rtc/rtc-v3020.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
index d2da92187d56..e947cd1538a9 100644
--- a/drivers/rtc/rtc-v3020.c
+++ b/drivers/rtc/rtc-v3020.c
@@ -329,13 +329,18 @@ static int rtc_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, chip);

- chip->rtc = devm_rtc_device_register(&pdev->dev, "v3020",
- &v3020_rtc_ops, THIS_MODULE);
+ chip->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(chip->rtc)) {
retval = PTR_ERR(chip->rtc);
goto err_io;
}

+ chip->rtc->ops = &v3020_rtc_ops;
+
+ retval = devm_rtc_register_device(chip->rtc);
+ if (retval)
+ goto err_io;
+
return 0;

err_io:
--
2.29.1