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

From: Bartosz Golaszewski
Date: Thu Nov 19 2020 - 06:45:31 EST


From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>

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

Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
---
drivers/rtc/rtc-asm9260.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

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:
--
2.29.1