diff mbox series

[55/59] rtc: rtd119x: stop using deprecated RTC API

Message ID 20201119114149.4117-56-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-rtd119x.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-rtd119x.c b/drivers/rtc/rtc-rtd119x.c
index bb98f2d574a5..547ab60adb3f 100644
--- a/drivers/rtc/rtc-rtd119x.c
+++ b/drivers/rtc/rtc-rtd119x.c
@@ -205,10 +205,17 @@  static int rtd119x_rtc_probe(struct platform_device *pdev)
 
 	rtd119x_rtc_set_enabled(&pdev->dev, true);
 
-	data->rtcdev = devm_rtc_device_register(&pdev->dev, "rtc",
-						&rtd119x_rtc_ops, THIS_MODULE);
+	data->rtcdev = devm_rtc_allocate_device(&pdev->dev);
 	if (IS_ERR(data->rtcdev)) {
-		dev_err(&pdev->dev, "failed to register rtc device");
+		clk_disable_unprepare(data->clk);
+		clk_put(data->clk);
+		return PTR_ERR(data->rtcdev);
+	}
+
+	data->rtcdev->ops = &rtd119x_rtc_ops;
+
+	ret = devm_rtc_register_device(data->rtcdev);
+	if (ret) {
 		clk_disable_unprepare(data->clk);
 		clk_put(data->clk);
 		return PTR_ERR(data->rtcdev);