[PATCH 01/59] rtc: da9055: stop using deprecated RTC API
From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:49:09 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-da9055.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
index 844168fcae1e..1e76042c2ed7 100644
--- a/drivers/rtc/rtc-da9055.c
+++ b/drivers/rtc/rtc-da9055.c
@@ -279,23 +279,22 @@ static int da9055_rtc_probe(struct platform_device *pdev)
ret = da9055_rtc_device_init(rtc->da9055, pdata);
if (ret < 0)
- goto err_rtc;
+ return ret;
ret = da9055_reg_read(rtc->da9055, DA9055_REG_ALARM_Y);
if (ret < 0)
- goto err_rtc;
+ return ret;
if (ret & DA9055_RTC_ALM_EN)
rtc->alarm_enable = 1;
device_init_wakeup(&pdev->dev, 1);
- rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
- &da9055_rtc_ops, THIS_MODULE);
- if (IS_ERR(rtc->rtc)) {
- ret = PTR_ERR(rtc->rtc);
- goto err_rtc;
- }
+ rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
+ if (IS_ERR(rtc->rtc))
+ return PTR_ERR(rtc->rtc);
+
+ rtc->rtc->ops = &da9055_rtc_ops;
alm_irq = platform_get_irq_byname(pdev, "ALM");
if (alm_irq < 0)
@@ -308,9 +307,7 @@ static int da9055_rtc_probe(struct platform_device *pdev)
if (ret != 0)
dev_err(rtc->da9055->dev, "irq registration failed: %d\n", ret);
-err_rtc:
- return ret;
-
+ return devm_rtc_register_device(rtc->rtc);
}
#ifdef CONFIG_PM
--
2.29.1