* [PATCH 00/12] rtc: clear the wake IRQ on unbind
@ 2026-11-25 7:20 Prasanth R
2026-11-25 7:20 ` [PATCH 01/12] rtc: snvs: " Prasanth R
` (11 more replies)
0 siblings, 12 replies; 17+ 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
From: Prasanth R <ragaprasanth@gmail.com>
These drivers set a wake IRQ with dev_pm_set_wake_irq() and never clear
it. After unbind and bind, dev_pm_set_wake_irq() warns "wake irq already
initialized" and returns -EEXIST. For jz4740 and atcrtc100 the probe
then fails.
Switch them to devm_pm_set_wake_irq() and devm_device_init_wakeup(), as
was done for rtc-pl031, rtc-stm32 and others. Patch 3 also fixes an
unbalanced clock disable in the mxc_v2 remove path.
Patch 1 is tested on an i.MX6Q SABRE-SD board by unbinding and binding
the driver through sysfs. The others are compile-tested only (ARM,
clang, W=1).
I used an AI assistant (Claude) to find these and write the changes.
Prasanth R (12):
rtc: snvs: clear the wake IRQ on unbind
rtc: mxc: clear the wake IRQ on unbind
rtc: mxc_v2: fix unbalanced clock disable on remove
rtc: mxc_v2: clear the wake IRQ on unbind
rtc: imxdi: clear the wake IRQ on removal
rtc: da9063: clear the wake IRQ on unbind
rtc: fsl-ftm-alarm: clear the wake IRQ on unbind
rtc: jz4740: clear the wake IRQ on unbind
rtc: atcrtc100: clear the wake IRQ on unbind
rtc: pcf8523: clear the wake IRQ on unbind
rtc: pcf85063: clear the wake IRQ on unbind
rtc: rv8803: clear the wake IRQ on unbind
drivers/rtc/rtc-atcrtc100.c | 8 +++-----
drivers/rtc/rtc-da9063.c | 4 ++--
drivers/rtc/rtc-fsl-ftm-alarm.c | 4 ++--
drivers/rtc/rtc-imxdi.c | 4 ++--
drivers/rtc/rtc-jz4740.c | 4 ++--
drivers/rtc/rtc-mxc.c | 4 ++--
drivers/rtc/rtc-mxc_v2.c | 6 +++---
drivers/rtc/rtc-pcf85063.c | 4 ++--
drivers/rtc/rtc-pcf8523.c | 4 ++--
drivers/rtc/rtc-rv8803.c | 6 +++---
drivers/rtc/rtc-snvs.c | 7 +++++--
11 files changed, 28 insertions(+), 27 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 17+ messages in thread
* [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 7:20 ` [PATCH 02/12] rtc: mxc: " Prasanth R
` (10 subsequent siblings)
11 siblings, 0 replies; 17+ 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] 17+ 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; 17+ 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] 17+ 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; 17+ 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] 17+ 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 7:25 ` sashiko-bot
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; 17+ 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] 17+ 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; 17+ 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] 17+ 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; 17+ 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] 17+ 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; 17+ 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] 17+ 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 7:20 ` [PATCH 09/12] rtc: atcrtc100: " Prasanth R
` (3 subsequent siblings)
11 siblings, 0 replies; 17+ 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] 17+ 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; 17+ 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] 17+ 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:33 ` sashiko-bot
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, 1 reply; 17+ 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] 17+ 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:29 ` sashiko-bot
2026-11-25 7:20 ` [PATCH 12/12] rtc: rv8803: " Prasanth R
11 siblings, 1 reply; 17+ 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] 17+ 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
2026-11-25 7:32 ` sashiko-bot
11 siblings, 1 reply; 17+ 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] 17+ 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 7:25 ` sashiko-bot
0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-11-25 7:25 UTC (permalink / raw)
To: Prasanth R, linux-rtc; +Cc: imx, Frank.Li, Alexandre Belloni
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] rtc: mxc_v2: unhandled interrupt storm in mxc_rtc_remove() [1]
--
commit f8f7168b7242f3f7ce38e7545b8decc669f9b81a
Author: Prasanth R <ragaprasanth@gmail.com>
rtc: mxc_v2: clear the wake IRQ on unbind
This commit replaces device_init_wakeup() and dev_pm_set_wake_irq() with
their device-managed variants in mxc_rtc_probe() so the wakeup source and
wake IRQ are released on unbind.
> diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c
> index 35a18b75c1098..fe3a55b00418b 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");
>
[Severity: High]
This problem wasn't introduced by this patch, but can unbinding the driver
while a hardware alarm is armed trigger an unhandled interrupt storm
[1]?
drivers/rtc/rtc-mxc_v2.c:mxc_rtc_remove() {
struct mxc_rtc_data *pdata = platform_get_drvdata(pdev);
clk_unprepare(pdata->clk);
}
mxc_rtc_remove() does not clear SRTC_LPCR_ALP or SRTC_LPCR_WAE before
devres unregisters the IRQ handler. If a pending alarm fires afterward,
no handler is left to acknowledge it and the IRQ core disables the line
with "nobody cared".
[1] https://sashiko.dev/#/bug/linux-4a7ad9ff-00aa-4c3f-aa57-966cdc8a71a1
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125072026.2997493-1-prasanth.r@lineo.co.jp?part=4
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 11/12] rtc: pcf85063: clear the wake IRQ on unbind
2026-11-25 7:20 ` [PATCH 11/12] rtc: pcf85063: " Prasanth R
@ 2026-11-25 7:29 ` sashiko-bot
0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-11-25 7:29 UTC (permalink / raw)
To: Prasanth R, linux-rtc; +Cc: imx, Frank.Li, Alexandre Belloni
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] rtc: pcf85063: Fixes trailer cites 05cb3a56ee8c instead of
a3c7f7e16ea8f
--
commit 02e3d5d53e616f78f39dfc9fe5c12cd70b022082
Author: Prasanth R <ragaprasanth@gmail.com>
> rtc: pcf85063: clear the wake IRQ on unbind
>
> 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>
[Severity: Low]
In 05cb3a56ee8c ("rtc: pcf85063: add alarm support"), this driver only
registered an i2c_driver, and the I2C core's i2c_device_remove() already
calls dev_pm_clear_wake_irq() and device_init_wakeup(dev, false) on
unbind. The unbind leak only became possible when SPI support was added
via rv8063_probe(), since spi_remove() does not clear the wake IRQ or
wakeup source. Should the Fixes tag instead be:
Fixes: a3c7f7e16ea8 ("rtc: pcf85063: add support for RV8063")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125072026.2997493-1-prasanth.r@lineo.co.jp?part=11
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 12/12] rtc: rv8803: clear the wake IRQ on unbind
2026-11-25 7:20 ` [PATCH 12/12] rtc: rv8803: " Prasanth R
@ 2026-11-25 7:32 ` sashiko-bot
0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-11-25 7:32 UTC (permalink / raw)
To: Prasanth R, linux-rtc; +Cc: imx, Frank.Li, Alexandre Belloni
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] rtc: rv8803: redundant devm wakeup cleanup in rv8803_probe()
--
commit 3a55bfc9ac0b1aa7bcd9e1d8fb75ae431e24df8c
Author: Prasanth R <ragaprasanth@gmail.com>
rtc: rv8803: clear the wake IRQ on unbind
This commit replaces device_init_wakeup() and dev_pm_set_wake_irq() in
rv8803_probe() with devm_device_init_wakeup() and devm_pm_set_wake_irq()
to release the wake IRQ and wakeup source on unbind.
> diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
> index 7445c81510560..9dbbaffcd489b 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);
> }
[Severity: Medium]
Can unbinding rv8803 actually leave the wake IRQ or wakeup source behind?
i2c_bus_type uses i2c_device_remove() as its bus remove callback, which
runs unconditionally on unbind even when the i2c_driver has no .remove
callback (and i2c_device_probe() runs the same cleanup on probe failure):
drivers/i2c/i2c-core-base.c:i2c_device_remove() {
...
devres_release_group(&client->dev, client->devres_group_id);
dev_pm_clear_wake_irq(&client->dev);
device_init_wakeup(&client->dev, false);
...
}
Switching to devm_device_init_wakeup() and devm_pm_set_wake_irq() only
registers redundant devres actions on top of what the I2C core already
tears down.
Note that if "wake irq already initialized" (-EEXIST) is seen during
probe, that happens on initial bind when I2C_CLIENT_WAKE is set (for
example, when "wakeup-source" is specified alongside an interrupt in DT),
because i2c_device_probe() already calls device_init_wakeup() and
dev_pm_set_wake_irq() before invoking the driver's probe callback.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125072026.2997493-1-prasanth.r@lineo.co.jp?part=12
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 10/12] rtc: pcf8523: clear the wake IRQ on unbind
2026-11-25 7:20 ` [PATCH 10/12] rtc: pcf8523: " Prasanth R
@ 2026-11-25 7:33 ` sashiko-bot
0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-11-25 7:33 UTC (permalink / raw)
To: Prasanth R, linux-rtc; +Cc: imx, Frank.Li, Alexandre Belloni
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] rtc: pcf8523: redundant devm wake cleanup in pcf8523_probe()
on i2c_bus_type
--
commit 5ba5c98fa87e67c51600bf8ba44e25608c7b2cde
Author: Prasanth R <ragaprasanth@gmail.com>
rtc: pcf8523: clear the wake IRQ on unbind
This commit switches pcf8523_probe() from dev_pm_set_wake_irq() and
device_init_wakeup() to their devm-managed variants so that the wake IRQ
and wakeup source are cleared on driver unbind.
> diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
> index bbd42358a4c24..df70a374ef0ff 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);
> }
[Severity: Medium]
Can an i2c_driver without a .remove callback actually leak its wake IRQ
or wakeup source on unbind?
On unbind, device_remove() invokes i2c_bus_type.remove
(i2c_device_remove()) even when driver->remove is NULL, and
i2c_device_remove() already clears both unconditionally:
drivers/i2c/i2c-core-base.c:i2c_device_remove() {
...
devres_release_group(&client->dev, client->devres_group_id);
dev_pm_clear_wake_irq(&client->dev);
device_init_wakeup(&client->dev, false);
...
}
i2c_device_probe() performs the same cleanup at err_clear_wakeup_irq when
driver->probe() fails. Switching to devm_pm_set_wake_irq() and
devm_device_init_wakeup() here only adds redundant devres actions right
before the I2C core repeats the same teardown. Note also that when
"wakeup-source" is set in DT (setting I2C_CLIENT_WAKE) and
client->irq > 0, i2c_device_probe() already calls dev_pm_set_wake_irq()
before invoking pcf8523_probe(), so the "wake irq already initialized"
warning and -EEXIST happen during the initial probe rather than on
rebind.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125072026.2997493-1-prasanth.r@lineo.co.jp?part=10
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2026-11-25 7:33 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 03/12] rtc: mxc_v2: fix unbalanced clock disable on remove Prasanth R
2026-11-25 7:20 ` [PATCH 04/12] rtc: mxc_v2: clear the wake IRQ on unbind Prasanth R
2026-11-25 7:25 ` sashiko-bot
2026-11-25 7:20 ` [PATCH 05/12] rtc: imxdi: clear the wake IRQ on removal Prasanth R
2026-11-25 7:20 ` [PATCH 06/12] rtc: da9063: clear the wake IRQ on unbind Prasanth R
2026-11-25 7:20 ` [PATCH 07/12] rtc: fsl-ftm-alarm: " Prasanth R
2026-11-25 7:20 ` [PATCH 08/12] rtc: jz4740: " Prasanth R
2026-11-25 7:20 ` [PATCH 09/12] rtc: atcrtc100: " Prasanth R
2026-11-25 7:20 ` [PATCH 10/12] rtc: pcf8523: " Prasanth R
2026-11-25 7:33 ` sashiko-bot
2026-11-25 7:20 ` [PATCH 11/12] rtc: pcf85063: " Prasanth R
2026-11-25 7:29 ` sashiko-bot
2026-11-25 7:20 ` [PATCH 12/12] rtc: rv8803: " Prasanth R
2026-11-25 7:32 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox