diff mbox series

[50/59] rtc: v3020: stop using deprecated RTC API

Message ID 20201119114149.4117-51-brgl@bgdev.pl
State Rejected
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-v3020.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
index d2da92187d56..e947cd1538a9 100644
--- a/drivers/rtc/rtc-v3020.c
+++ b/drivers/rtc/rtc-v3020.c
@@ -329,13 +329,18 @@  static int rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, chip);
 
-	chip->rtc = devm_rtc_device_register(&pdev->dev, "v3020",
-					&v3020_rtc_ops, THIS_MODULE);
+	chip->rtc = devm_rtc_allocate_device(&pdev->dev);
 	if (IS_ERR(chip->rtc)) {
 		retval = PTR_ERR(chip->rtc);
 		goto err_io;
 	}
 
+	chip->rtc->ops = &v3020_rtc_ops;
+
+	retval = devm_rtc_register_device(chip->rtc);
+	if (retval)
+		goto err_io;
+
 	return 0;
 
 err_io: