[PATCH 27/59] rtc: max77686: stop using deprecated RTC API

From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:46:14 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-max77686.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index d51cc12114cb..e2edae346f1c 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -758,17 +758,14 @@ static int max77686_rtc_probe(struct platform_device *pdev)

device_init_wakeup(&pdev->dev, 1);

- info->rtc_dev = devm_rtc_device_register(&pdev->dev, id->name,
- &max77686_rtc_ops, THIS_MODULE);
-
+ info->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(info->rtc_dev)) {
ret = PTR_ERR(info->rtc_dev);
- dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
- if (ret == 0)
- ret = -EINVAL;
goto err_rtc;
}

+ info->rtc_dev->ops = &max77686_rtc_ops;
+
info->virq = regmap_irq_get_virq(info->rtc_irq_data,
MAX77686_RTCIRQ_RTCA1);
if (info->virq <= 0) {
@@ -784,6 +781,10 @@ static int max77686_rtc_probe(struct platform_device *pdev)
goto err_rtc;
}

+ ret = devm_rtc_register_device(info->rtc_dev);
+ if (ret)
+ goto err_rtc;
+
return 0;

err_rtc:
--
2.29.1