diff mbox series

[22/59] rtc: moxart: stop using deprecated RTC API

Message ID 20201119114149.4117-23-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-moxart.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-moxart.c b/drivers/rtc/rtc-moxart.c
index 6b24ac9e1cfa..f354bc8abecf 100644
--- a/drivers/rtc/rtc-moxart.c
+++ b/drivers/rtc/rtc-moxart.c
@@ -294,15 +294,13 @@  static int moxart_rtc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	moxart_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-						   &moxart_rtc_ops,
-						   THIS_MODULE);
-	if (IS_ERR(moxart_rtc->rtc)) {
-		dev_err(&pdev->dev, "devm_rtc_device_register failed\n");
+	moxart_rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
+	if (IS_ERR(moxart_rtc->rtc))
 		return PTR_ERR(moxart_rtc->rtc);
-	}
 
-	return 0;
+	moxart_rtc->rtc->ops = &moxart_rtc_ops;
+
+	return devm_rtc_register_device(moxart_rtc->rtc);
 }
 
 static const struct of_device_id moxart_rtc_match[] = {