diff mbox series

[36/59] rtc: asm9260: stop using deprecated RTC API

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

Patch

diff --git a/drivers/rtc/rtc-asm9260.c b/drivers/rtc/rtc-asm9260.c
index 3ab81cdec00b..c74455bce8b4 100644
--- a/drivers/rtc/rtc-asm9260.c
+++ b/drivers/rtc/rtc-asm9260.c
@@ -284,14 +284,14 @@  static int asm9260_rtc_probe(struct platform_device *pdev)
 	iowrite32(0, priv->iobase + HW_CIIR);
 	iowrite32(BM_AMR_OFF, priv->iobase + HW_AMR);
 
-	priv->rtc = devm_rtc_device_register(dev, dev_name(dev),
-					     &asm9260_rtc_ops, THIS_MODULE);
+	priv->rtc = devm_rtc_allocate_device(dev);
 	if (IS_ERR(priv->rtc)) {
 		ret = PTR_ERR(priv->rtc);
-		dev_err(dev, "Failed to register RTC device: %d\n", ret);
 		goto err_return;
 	}
 
+	priv->rtc->ops = &asm9260_rtc_ops;
+
 	ret = devm_request_threaded_irq(dev, irq_alarm, NULL,
 					asm9260_rtc_irq, IRQF_ONESHOT,
 					dev_name(dev), priv);
@@ -301,6 +301,10 @@  static int asm9260_rtc_probe(struct platform_device *pdev)
 		goto err_return;
 	}
 
+	ret = devm_rtc_register_device(priv->rtc);
+	if (ret)
+		goto err_return;
+
 	return 0;
 
 err_return: