[PATCH 01/12] rtc: snvs: clear the wake IRQ on unbind
Marco Felsch
m.felsch at pengutronix.de
Wed Nov 25 01:18:55 PST 2026
Hi Prasanth,
thanks for the patches, please see below.
On 26-11-25 16:20, Prasanth R wrote:
> From: Prasanth R <ragaprasanth at gmail.com>
>
> The driver has no remove callback, so the wake IRQ set with
> dev_pm_set_wake_irq() and the wakeup source enabled with
> device_init_wakeup() are never released on unbind.
>
> When the driver is bound again, dev_pm_set_wake_irq() finds the old
> wake IRQ, warns "wake irq already initialized" and returns -EEXIST, so
> the driver prints "failed to enable irq wake".
>
> Use the device-managed variants so both are released on unbind.
>
> Tested on an i.MX6Q SABRE-SD board by unbinding and binding the driver
> through sysfs.
>
> I used an AI assistant (Claude) to find this and write the change.
>
> Fixes: e7afddb2b4d2 ("rtc: snvs: use dev_pm_set_wake_irq() to simplify code")
> Signed-off-by: Prasanth R <prasanth.r at lineo.co.jp>
> ---
> drivers/rtc/rtc-snvs.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
> index d99a352d6..647952dcd 100644
> --- a/drivers/rtc/rtc-snvs.c
> +++ b/drivers/rtc/rtc-snvs.c
> @@ -383,8 +383,11 @@ static int snvs_rtc_probe(struct platform_device *pdev)
> return ret;
> }
>
> - device_init_wakeup(&pdev->dev, true);
> - ret = dev_pm_set_wake_irq(&pdev->dev, data->irq);
> + ret = devm_device_init_wakeup(&pdev->dev);
> + if (ret)
> + dev_err(&pdev->dev, "failed to init wakeup, %d\n", ret);
If there is an error you should return here. I would also suggest to at
a proper failure handling for devm_device_init_wakeup() on all the other
patches, albeit these drivers may not handle it today. Furthermore these
days dev_err_probe() should be used during probe, so you have a pattern
like:
if (ret)
return dev_err_probe(&pdev->dev, ret, "failed to init wakeup\n");
Regards,
Marco
> +
> + ret = devm_pm_set_wake_irq(&pdev->dev, data->irq);
> if (ret)
> dev_err(&pdev->dev, "failed to enable irq wake\n");
>
> --
> 2.43.0
>
>
>
More information about the linux-arm-kernel
mailing list