[PATCH 25/59] rtc: lpc24xx: stop using deprecated RTC API
From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:43:29 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-lpc24xx.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-lpc24xx.c b/drivers/rtc/rtc-lpc24xx.c
index eec881a81067..e28a00be2c0d 100644
--- a/drivers/rtc/rtc-lpc24xx.c
+++ b/drivers/rtc/rtc-lpc24xx.c
@@ -247,14 +247,18 @@ static int lpc24xx_rtc_probe(struct platform_device *pdev)
goto disable_clks;
}
- rtc->rtc = devm_rtc_device_register(&pdev->dev, "lpc24xx-rtc",
- &lpc24xx_rtc_ops, THIS_MODULE);
+ rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtc)) {
- dev_err(&pdev->dev, "can't register rtc device\n");
ret = PTR_ERR(rtc->rtc);
goto disable_clks;
}
+ rtc->rtc->ops = &lpc24xx_rtc_ops;
+
+ ret = devm_rtc_register_device(rtc->rtc);
+ if (ret)
+ goto disable_clks;
+
return 0;
disable_clks:
--
2.29.1