[PATCH 58/59] rtc: lp8788: stop using deprecated RTC API
From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:43:37 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-lp8788.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-lp8788.c b/drivers/rtc/rtc-lp8788.c
index c0b8fbce1082..c93bf5566e0b 100644
--- a/drivers/rtc/rtc-lp8788.c
+++ b/drivers/rtc/rtc-lp8788.c
@@ -295,17 +295,16 @@ static int lp8788_rtc_probe(struct platform_device *pdev)
device_init_wakeup(dev, 1);
- rtc->rdev = devm_rtc_device_register(dev, "lp8788_rtc",
- &lp8788_rtc_ops, THIS_MODULE);
- if (IS_ERR(rtc->rdev)) {
- dev_err(dev, "can not register rtc device\n");
+ rtc->rdev = devm_rtc_allocate_device(dev);
+ if (IS_ERR(rtc->rdev))
return PTR_ERR(rtc->rdev);
- }
+
+ rtc->rdev->ops = &lp8788_rtc_ops;
if (lp8788_alarm_irq_register(pdev, rtc))
dev_warn(lp->dev, "no rtc irq handler\n");
- return 0;
+ return devm_rtc_register_device(rtc->rdev);
}
static struct platform_driver lp8788_rtc_driver = {
--
2.29.1