* [PATCH 01/12] rtc: snvs: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 9:18 ` Marco Felsch
2026-11-25 7:20 ` [PATCH 02/12] rtc: mxc: " Prasanth R
` (10 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@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@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);
+
+ 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
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 01/12] rtc: snvs: clear the wake IRQ on unbind
2026-11-25 7:20 ` [PATCH 01/12] rtc: snvs: " Prasanth R
@ 2026-11-25 9:18 ` Marco Felsch
2026-11-26 0:13 ` Prasanth Ramesh
0 siblings, 1 reply; 19+ messages in thread
From: Marco Felsch @ 2026-11-25 9:18 UTC (permalink / raw)
To: Prasanth R
Cc: Alexandre Belloni, linux-rtc, imx, Support Opensource, Prasanth R,
Sascha Hauer, Frank Li, CL Wang, linux-mips, Paul Cercueil,
Pengutronix Kernel Team, Fabio Estevam, linux-arm-kernel
Hi Prasanth,
thanks for the patches, please see below.
On 26-11-25 16:20, Prasanth R wrote:
> From: Prasanth R <ragaprasanth@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@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
>
>
>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 01/12] rtc: snvs: clear the wake IRQ on unbind
2026-11-25 9:18 ` Marco Felsch
@ 2026-11-26 0:13 ` Prasanth Ramesh
0 siblings, 0 replies; 19+ messages in thread
From: Prasanth Ramesh @ 2026-11-26 0:13 UTC (permalink / raw)
To: Marco Felsch
Cc: Alexandre Belloni, linux-rtc, imx, Support Opensource, Prasanth R,
Sascha Hauer, Frank Li, CL Wang, linux-mips, Paul Cercueil,
Pengutronix Kernel Team, Fabio Estevam, linux-arm-kernel
Hi Marco,
Thanks for the feedback. You're right, I should have added proper
error handling. I'll use dev_err_probe() and address this across the
series in the v2.
Thanks,
Prasanth
On Wed, Nov 25, 2026 at 6:18 PM Marco Felsch <m.felsch@pengutronix.de> wrote:
>
> Hi Prasanth,
>
> thanks for the patches, please see below.
>
> On 26-11-25 16:20, Prasanth R wrote:
> > From: Prasanth R <ragaprasanth@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@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
> >
> >
> >
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 02/12] rtc: mxc: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
2026-11-25 7:20 ` [PATCH 01/12] rtc: snvs: " Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 7:20 ` [PATCH 03/12] rtc: mxc_v2: fix unbalanced clock disable on remove Prasanth R
` (9 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@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.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: bc0e731fc289 ("rtc: mxc: use dev_pm_set_wake_irq() to simplify code")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-mxc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index f91b0994b..90b383896 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -377,8 +377,8 @@ static int mxc_rtc_probe(struct platform_device *pdev)
}
if (pdata->irq >= 0) {
- device_init_wakeup(&pdev->dev, true);
- ret = dev_pm_set_wake_irq(&pdev->dev, pdata->irq);
+ devm_device_init_wakeup(&pdev->dev);
+ ret = devm_pm_set_wake_irq(&pdev->dev, pdata->irq);
if (ret)
dev_err(&pdev->dev, "failed to enable irq wake\n");
}
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 03/12] rtc: mxc_v2: fix unbalanced clock disable on remove
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
2026-11-25 7:20 ` [PATCH 01/12] rtc: snvs: " Prasanth R
2026-11-25 7:20 ` [PATCH 02/12] rtc: mxc: " Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 7:20 ` [PATCH 04/12] rtc: mxc_v2: clear the wake IRQ on unbind Prasanth R
` (8 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@gmail.com>
Probe leaves the clock prepared but disabled, and the RTC callbacks
enable it only around register accesses. mxc_rtc_remove() still calls
clk_disable_unprepare(), so the clock is disabled once more than it was
enabled and the clock core warns "already disabled".
Only unprepare the clock in remove, as the probe error paths after
clk_disable() already do.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: 83c880f79e88 ("rtc: add mxc driver for i.MX53 SRTC")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-mxc_v2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c
index 965170bb8..35a18b75c 100644
--- a/drivers/rtc/rtc-mxc_v2.c
+++ b/drivers/rtc/rtc-mxc_v2.c
@@ -365,7 +365,7 @@ static void mxc_rtc_remove(struct platform_device *pdev)
{
struct mxc_rtc_data *pdata = platform_get_drvdata(pdev);
- clk_disable_unprepare(pdata->clk);
+ clk_unprepare(pdata->clk);
}
static const struct of_device_id mxc_ids[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 04/12] rtc: mxc_v2: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
` (2 preceding siblings ...)
2026-11-25 7:20 ` [PATCH 03/12] rtc: mxc_v2: fix unbalanced clock disable on remove Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 21:52 ` Frank Li
2026-11-25 7:20 ` [PATCH 05/12] rtc: imxdi: clear the wake IRQ on removal Prasanth R
` (7 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@gmail.com>
mxc_rtc_remove() and the probe error paths do not release the wake IRQ
set with dev_pm_set_wake_irq() or the wakeup source enabled with
device_init_wakeup().
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.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: fbc5ee9a6955 ("rtc: mxc_v2: use dev_pm_set_wake_irq() to simplify code")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-mxc_v2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c
index 35a18b75c..fe3a55b00 100644
--- a/drivers/rtc/rtc-mxc_v2.c
+++ b/drivers/rtc/rtc-mxc_v2.c
@@ -301,8 +301,8 @@ static int mxc_rtc_probe(struct platform_device *pdev)
if (pdata->irq < 0)
return pdata->irq;
- device_init_wakeup(&pdev->dev, true);
- ret = dev_pm_set_wake_irq(&pdev->dev, pdata->irq);
+ devm_device_init_wakeup(&pdev->dev);
+ ret = devm_pm_set_wake_irq(&pdev->dev, pdata->irq);
if (ret)
dev_err(&pdev->dev, "failed to enable irq wake\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 04/12] rtc: mxc_v2: clear the wake IRQ on unbind
2026-11-25 7:20 ` [PATCH 04/12] rtc: mxc_v2: clear the wake IRQ on unbind Prasanth R
@ 2026-11-25 21:52 ` Frank Li
2026-11-26 0:28 ` Prasanth Ramesh
0 siblings, 1 reply; 19+ messages in thread
From: Frank Li @ 2026-11-25 21:52 UTC (permalink / raw)
To: Prasanth R
Cc: Alexandre Belloni, linux-rtc, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Support Opensource,
Paul Cercueil, CL Wang, imx, linux-arm-kernel, linux-mips,
Prasanth R
On Wed, Nov 25, 2026 at 04:20:18PM +0900, Prasanth R wrote:
> [You don't often get email from ragaprasanth@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Prasanth R <ragaprasanth@gmail.com>
>
> mxc_rtc_remove() and the probe error paths do not release the wake IRQ
> set with dev_pm_set_wake_irq() or the wakeup source enabled with
> device_init_wakeup().
>
> 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.
>
> Compile-tested only.
>
> I used an AI assistant (Claude) to find this and write the change.
Needn't it at commit message, you can move it after --- to tell maintainer
you use AI help.
>
> Fixes: fbc5ee9a6955 ("rtc: mxc_v2: use dev_pm_set_wake_irq() to simplify code")
> Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
> ---
> drivers/rtc/rtc-mxc_v2.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c
> index 35a18b75c..fe3a55b00 100644
> --- a/drivers/rtc/rtc-mxc_v2.c
> +++ b/drivers/rtc/rtc-mxc_v2.c
> @@ -301,8 +301,8 @@ static int mxc_rtc_probe(struct platform_device *pdev)
> if (pdata->irq < 0)
> return pdata->irq;
>
> - device_init_wakeup(&pdev->dev, true);
> - ret = dev_pm_set_wake_irq(&pdev->dev, pdata->irq);
> + devm_device_init_wakeup(&pdev->dev);
all devm_*() API need check return value.
Frank
> + ret = devm_pm_set_wake_irq(&pdev->dev, pdata->irq);
> if (ret)
> dev_err(&pdev->dev, "failed to enable irq wake\n");
>
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 04/12] rtc: mxc_v2: clear the wake IRQ on unbind
2026-11-25 21:52 ` Frank Li
@ 2026-11-26 0:28 ` Prasanth Ramesh
0 siblings, 0 replies; 19+ messages in thread
From: Prasanth Ramesh @ 2026-11-26 0:28 UTC (permalink / raw)
To: Frank Li
Cc: Alexandre Belloni, linux-rtc, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Support Opensource,
Paul Cercueil, CL Wang, imx, linux-arm-kernel, linux-mips,
Prasanth R
Hi Frank,
> Needn't it at commit message, you can move it after --- to tell maintainer
> you use AI help.
Sure, I will move it in v2.
> all devm_*() API need check return value.
Will be fixed in v2.
Thanks,
Prasanth
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 05/12] rtc: imxdi: clear the wake IRQ on removal
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
` (3 preceding siblings ...)
2026-11-25 7:20 ` [PATCH 04/12] rtc: mxc_v2: clear the wake IRQ on unbind Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 7:20 ` [PATCH 06/12] rtc: da9063: clear the wake IRQ on unbind Prasanth R
` (6 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@gmail.com>
dryice_rtc_remove() and the probe error path do not release the wake IRQ
set with dev_pm_set_wake_irq() or the wakeup source enabled with
device_init_wakeup().
When the module is loaded again, dev_pm_set_wake_irq() finds the old
wake IRQ and warns "wake irq already initialized".
Use the device-managed variants so both are released when the driver is
removed.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: bcae59d0d45b ("rtc: imxdi: add wakeup support")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-imxdi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c
index 4066e32b5..a1afe84d6 100644
--- a/drivers/rtc/rtc-imxdi.c
+++ b/drivers/rtc/rtc-imxdi.c
@@ -812,8 +812,8 @@ static int __init dryice_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, imxdi);
- device_init_wakeup(&pdev->dev, true);
- dev_pm_set_wake_irq(&pdev->dev, norm_irq);
+ devm_device_init_wakeup(&pdev->dev);
+ devm_pm_set_wake_irq(&pdev->dev, norm_irq);
imxdi->rtc->ops = &dryice_rtc_ops;
imxdi->rtc->range_max = U32_MAX;
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 06/12] rtc: da9063: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
` (4 preceding siblings ...)
2026-11-25 7:20 ` [PATCH 05/12] rtc: imxdi: clear the wake IRQ on removal Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 7:20 ` [PATCH 07/12] rtc: fsl-ftm-alarm: " Prasanth R
` (5 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@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 warns that it failed to set the wake IRQ.
Use the device-managed variants so both are released on unbind.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: ed17a2bcbb75 ("rtc: da9063: Mark the alarm IRQ as a wake IRQ")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-da9063.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c
index b56b9d9cb..2bb32156d 100644
--- a/drivers/rtc/rtc-da9063.c
+++ b/drivers/rtc/rtc-da9063.c
@@ -466,13 +466,13 @@ static int da9063_rtc_probe(struct platform_device *pdev)
"Failed to request ALARM IRQ %d: %d\n",
irq_alarm, ret);
- ret = dev_pm_set_wake_irq(&pdev->dev, irq_alarm);
+ ret = devm_pm_set_wake_irq(&pdev->dev, irq_alarm);
if (ret)
dev_warn(&pdev->dev,
"Failed to set IRQ %d as a wake IRQ: %d\n",
irq_alarm, ret);
- device_init_wakeup(&pdev->dev, true);
+ devm_device_init_wakeup(&pdev->dev);
} else if (irq_alarm != -ENXIO) {
return irq_alarm;
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 07/12] rtc: fsl-ftm-alarm: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
` (5 preceding siblings ...)
2026-11-25 7:20 ` [PATCH 06/12] rtc: da9063: clear the wake IRQ on unbind Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 7:20 ` [PATCH 08/12] rtc: jz4740: " Prasanth R
` (4 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@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.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: 3a8ce46ce15a ("rtc: fsl-ftm-alarm: fix freeze(s2idle) failed to wake")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-fsl-ftm-alarm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c
index 5473f697d..565fd0df6 100644
--- a/drivers/rtc/rtc-fsl-ftm-alarm.c
+++ b/drivers/rtc/rtc-fsl-ftm-alarm.c
@@ -281,8 +281,8 @@ static int ftm_rtc_probe(struct platform_device *pdev)
rtc->alarm_freq = (u32)FIXED_FREQ_CLK / (u32)MAX_FREQ_DIV;
rtc->rtc_dev->ops = &ftm_rtc_ops;
- device_init_wakeup(&pdev->dev, true);
- ret = dev_pm_set_wake_irq(&pdev->dev, irq);
+ devm_device_init_wakeup(&pdev->dev);
+ ret = devm_pm_set_wake_irq(&pdev->dev, irq);
if (ret)
dev_err(&pdev->dev, "failed to enable irq wake\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 08/12] rtc: jz4740: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
` (6 preceding siblings ...)
2026-11-25 7:20 ` [PATCH 07/12] rtc: fsl-ftm-alarm: " Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 14:38 ` Paul Cercueil
2026-11-25 7:20 ` [PATCH 09/12] rtc: atcrtc100: " Prasanth R
` (3 subsequent siblings)
11 siblings, 1 reply; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@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 probe
fails with "Failed to set wake irq" and the RTC cannot be bound again.
Use the device-managed variants so both are released on unbind.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: 3b2dc19ff9a1 ("rtc: jz4740: use dev_pm_set_wake_irq() to simplify code")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-jz4740.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
index 32c331f3f..41501c9ed 100644
--- a/drivers/rtc/rtc-jz4740.c
+++ b/drivers/rtc/rtc-jz4740.c
@@ -367,9 +367,9 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, rtc);
- device_init_wakeup(dev, true);
+ devm_device_init_wakeup(dev);
- ret = dev_pm_set_wake_irq(dev, irq);
+ ret = devm_pm_set_wake_irq(dev, irq);
if (ret)
return dev_err_probe(dev, ret, "Failed to set wake irq\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 08/12] rtc: jz4740: clear the wake IRQ on unbind
2026-11-25 7:20 ` [PATCH 08/12] rtc: jz4740: " Prasanth R
@ 2026-11-25 14:38 ` Paul Cercueil
2026-11-26 0:18 ` Prasanth Ramesh
0 siblings, 1 reply; 19+ messages in thread
From: Paul Cercueil @ 2026-11-25 14:38 UTC (permalink / raw)
To: Prasanth R, Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, CL Wang, imx, linux-arm-kernel, linux-mips,
Prasanth R
Hi Prasanth,
Le mercredi 25 novembre 2026 à 16:20 +0900, Prasanth R a écrit :
> From: Prasanth R <ragaprasanth@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 probe
> fails with "Failed to set wake irq" and the RTC cannot be bound again.
>
> Use the device-managed variants so both are released on unbind.
>
> Compile-tested only.
>
> I used an AI assistant (Claude) to find this and write the change.
>
> Fixes: 3b2dc19ff9a1 ("rtc: jz4740: use dev_pm_set_wake_irq() to simplify
> code")
Should probably Cc: stable@vger.kernel.org then.
> Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
(Your family name is R?)
> ---
> drivers/rtc/rtc-jz4740.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
> index 32c331f3f..41501c9ed 100644
> --- a/drivers/rtc/rtc-jz4740.c
> +++ b/drivers/rtc/rtc-jz4740.c
> @@ -367,9 +367,9 @@ static int jz4740_rtc_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, rtc);
>
> - device_init_wakeup(dev, true);
> + devm_device_init_wakeup(dev);
I see devm_device_init_wakeup() can return an error, which should be handled.
Cheers,
-Paul
>
> - ret = dev_pm_set_wake_irq(dev, irq);
> + ret = devm_pm_set_wake_irq(dev, irq);
> if (ret)
> return dev_err_probe(dev, ret, "Failed to set wake irq\n");
>
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 08/12] rtc: jz4740: clear the wake IRQ on unbind
2026-11-25 14:38 ` Paul Cercueil
@ 2026-11-26 0:18 ` Prasanth Ramesh
0 siblings, 0 replies; 19+ messages in thread
From: Prasanth Ramesh @ 2026-11-26 0:18 UTC (permalink / raw)
To: Paul Cercueil
Cc: Alexandre Belloni, linux-rtc, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Support Opensource,
CL Wang, imx, linux-arm-kernel, linux-mips, Prasanth R
> Should probably Cc: stable@vger.kernel.org then.
Will add it in v2.
> (Your family name is R?)
R is an initial from my father's name (Rameshbabu), "Prasanth R" is
how my name is written officially.
> I see devm_device_init_wakeup() can return an error, which should be handled.
Working in v2, it now fails the probe with dev_err_probe() suggested by Marco.
Thanks & Regards,
Prasanth
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 09/12] rtc: atcrtc100: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
` (7 preceding siblings ...)
2026-11-25 7:20 ` [PATCH 08/12] rtc: jz4740: " Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 7:20 ` [PATCH 10/12] rtc: pcf8523: " Prasanth R
` (2 subsequent siblings)
11 siblings, 0 replies; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@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 probe
fails with "Failed to set wake IRQ" and the RTC cannot be bound again.
Use the device-managed variants so both are released on unbind.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: 7adca706fe16 ("rtc: atcrtc100: Add ATCRTC100 RTC driver")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-atcrtc100.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-atcrtc100.c b/drivers/rtc/rtc-atcrtc100.c
index 25183331a..2c78192db 100644
--- a/drivers/rtc/rtc-atcrtc100.c
+++ b/drivers/rtc/rtc-atcrtc100.c
@@ -318,17 +318,15 @@ static int atcrtc_probe(struct platform_device *pdev)
"Failed to allocate RTC device\n");
set_bit(RTC_FEATURE_ALARM, atcrtc_dev->rtc_dev->features);
- ret = device_init_wakeup(&pdev->dev, true);
+ ret = devm_device_init_wakeup(&pdev->dev);
if (ret)
return dev_err_probe(&pdev->dev, ret,
"Failed to initialize wake capability\n");
- ret = dev_pm_set_wake_irq(&pdev->dev, atcrtc_dev->alarm_irq);
- if (ret) {
- device_init_wakeup(&pdev->dev, false);
+ ret = devm_pm_set_wake_irq(&pdev->dev, atcrtc_dev->alarm_irq);
+ if (ret)
return dev_err_probe(&pdev->dev, ret,
"Failed to set wake IRQ\n");
- }
atcrtc_dev->rtc_dev->ops = &rtc_ops;
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 10/12] rtc: pcf8523: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
` (8 preceding siblings ...)
2026-11-25 7:20 ` [PATCH 09/12] rtc: atcrtc100: " Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 7:20 ` [PATCH 11/12] rtc: pcf85063: " Prasanth R
2026-11-25 7:20 ` [PATCH 12/12] rtc: rv8803: " Prasanth R
11 siblings, 0 replies; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@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.
Use the device-managed variants so both are released on unbind.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: 13e37b7fb75d ("rtc: pcf8523: add alarm support")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-pcf8523.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
index bbd42358a..df70a374e 100644
--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -484,12 +484,12 @@ static int pcf8523_probe(struct i2c_client *client)
if (err)
return err;
- dev_pm_set_wake_irq(&client->dev, client->irq);
+ devm_pm_set_wake_irq(&client->dev, client->irq);
}
wakeup_source = of_property_read_bool(client->dev.of_node, "wakeup-source");
if (client->irq > 0 || wakeup_source)
- device_init_wakeup(&client->dev, true);
+ devm_device_init_wakeup(&client->dev);
return devm_rtc_register_device(rtc);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 11/12] rtc: pcf85063: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
` (9 preceding siblings ...)
2026-11-25 7:20 ` [PATCH 10/12] rtc: pcf8523: " Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
2026-11-25 7:20 ` [PATCH 12/12] rtc: rv8803: " Prasanth R
11 siblings, 0 replies; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@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.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: 05cb3a56ee8c ("rtc: pcf85063: add alarm support")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-pcf85063.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index 819648619..909c96e5e 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -704,8 +704,8 @@ static int pcf85063_probe(struct device *dev, struct regmap *regmap, int irq,
} else {
set_bit(RTC_FEATURE_UPDATE_INTERRUPT, pcf85063->rtc->features);
set_bit(RTC_FEATURE_ALARM, pcf85063->rtc->features);
- device_init_wakeup(dev, true);
- err = dev_pm_set_wake_irq(dev, irq);
+ devm_device_init_wakeup(dev);
+ err = devm_pm_set_wake_irq(dev, irq);
if (err)
dev_err(&pcf85063->rtc->dev,
"failed to enable irq wake\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 12/12] rtc: rv8803: clear the wake IRQ on unbind
2026-11-25 7:20 [PATCH 00/12] rtc: clear the wake IRQ on unbind Prasanth R
` (10 preceding siblings ...)
2026-11-25 7:20 ` [PATCH 11/12] rtc: pcf85063: " Prasanth R
@ 2026-11-25 7:20 ` Prasanth R
11 siblings, 0 replies; 19+ messages in thread
From: Prasanth R @ 2026-11-25 7:20 UTC (permalink / raw)
To: Alexandre Belloni, linux-rtc
Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Support Opensource, Paul Cercueil, CL Wang, imx, linux-arm-kernel,
linux-mips, Prasanth R, Prasanth R
From: Prasanth R <ragaprasanth@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 set wake IRQ".
Use the device-managed variants so both are released on unbind, also for
the wakeup-source case without an IRQ.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: 2f80de657f83 ("rtc: rv8803: Add power management support")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/rtc/rtc-rv8803.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index 7445c8151..9dbbaffcd 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -700,14 +700,14 @@ static int rv8803_probe(struct i2c_client *client)
dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n");
client->irq = 0;
} else {
- device_init_wakeup(&client->dev, true);
- err = dev_pm_set_wake_irq(&client->dev, client->irq);
+ devm_device_init_wakeup(&client->dev);
+ err = devm_pm_set_wake_irq(&client->dev, client->irq);
if (err)
dev_err(&client->dev, "failed to set wake IRQ\n");
}
} else {
if (device_property_read_bool(&client->dev, "wakeup-source"))
- device_init_wakeup(&client->dev, true);
+ devm_device_init_wakeup(&client->dev);
else
clear_bit(RTC_FEATURE_ALARM, rv8803->rtc->features);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread