From: Bartosz Golaszewski <[email protected]>

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

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
 drivers/rtc/rtc-spear.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index 833daeb7b60e..acdb37b98cc5 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -383,17 +383,19 @@ static int spear_rtc_probe(struct platform_device *pdev)
        spin_lock_init(&config->lock);
        platform_set_drvdata(pdev, config);
 
-       config->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-                                       &spear_rtc_ops, THIS_MODULE);
+       config->rtc = devm_rtc_allocate_device(&pdev->dev);
        if (IS_ERR(config->rtc)) {
-               dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
-                               PTR_ERR(config->rtc));
                status = PTR_ERR(config->rtc);
                goto err_disable_clock;
        }
 
+       config->rtc->ops = &spear_rtc_ops;
        config->rtc->uie_unsupported = 1;
 
+       status = devm_rtc_register_device(config->rtc);
+       if (status)
+               goto err_disable_clock;
+
        if (!device_can_wakeup(&pdev->dev))
                device_init_wakeup(&pdev->dev, 1);
 
-- 
2.29.1

Reply via email to