diff mbox series

[58/59] rtc: lp8788: stop using deprecated RTC API

Message ID 20201119114149.4117-59-brgl@bgdev.pl
State New
Headers show
Series rtc: remove all uses of devm_rtc_device_register() | expand

Commit Message

Bartosz Golaszewski Nov. 19, 2020, 11:41 a.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/rtc/rtc-lp8788.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

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 = {