]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rtc: pl031: Use resource managed API to simplify code
authorPeng Fan <peng.fan@nxp.com>
Wed, 5 Feb 2025 00:58:25 +0000 (08:58 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 3 Mar 2025 21:52:29 +0000 (22:52 +0100)
Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
error handling code and 'driver.remove()' hook.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250205-rtc-cleanup-v1-7-66165678e089@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-pl031.c

index bad6a5d9c6839ca70905e3d46286b9729c1fd435..47bfc5395e5908b7722b98276399120f1ba65af0 100644 (file)
@@ -284,8 +284,6 @@ static void pl031_remove(struct amba_device *adev)
 {
        struct pl031_local *ldata = dev_get_drvdata(&adev->dev);
 
-       dev_pm_clear_wake_irq(&adev->dev);
-       device_init_wakeup(&adev->dev, false);
        if (adev->irq[0])
                free_irq(adev->irq[0], ldata);
        amba_release_regions(adev);
@@ -350,7 +348,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
                }
        }
 
-       device_init_wakeup(&adev->dev, true);
+       devm_device_init_wakeup(&adev->dev);
        ldata->rtc = devm_rtc_allocate_device(&adev->dev);
        if (IS_ERR(ldata->rtc)) {
                ret = PTR_ERR(ldata->rtc);
@@ -373,7 +371,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
                                  vendor->irqflags, "rtc-pl031", ldata);
                if (ret)
                        goto out;
-               dev_pm_set_wake_irq(&adev->dev, adev->irq[0]);
+               devm_pm_set_wake_irq(&adev->dev, adev->irq[0]);
        }
        return 0;