* [PATCH 1/3] Input: snvs_pwrkey - clear the wake IRQ on unbind
2026-11-25 7:21 [PATCH 0/3] Input: clear the wake IRQ on unbind Prasanth R
@ 2026-11-25 7:21 ` Prasanth R
2026-11-25 7:21 ` [PATCH 2/3] Input: sun4i-lradc-keys " Prasanth R
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Prasanth R @ 2026-11-25 7:21 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input
Cc: Hans de Goede, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Support Opensource, linux-arm-kernel, linux-sunxi, 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 "irq wake enable failed.".
Use the device-managed variants so both are released on unbind. Only
enable the wakeup source when "wakeup-source" is set, as before.
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: fb3c09ba20ff ("Input: snvs_pwrkey - use dev_pm_set_wake_irq() to simplify code")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/input/keyboard/snvs_pwrkey.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index 33bc3bd0b..513fb9bbd 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -245,8 +245,13 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
if (error)
return dev_err_probe(dev, error, "failed to register input device\n");
- device_init_wakeup(dev, pdata->wakeup);
- error = dev_pm_set_wake_irq(dev, pdata->irq);
+ if (pdata->wakeup) {
+ error = devm_device_init_wakeup(dev);
+ if (error)
+ dev_err(dev, "failed to init wakeup: %d\n", error);
+ }
+
+ error = devm_pm_set_wake_irq(dev, pdata->irq);
if (error)
dev_err(dev, "irq wake enable failed.\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] Input: sun4i-lradc-keys - clear the wake IRQ on unbind
2026-11-25 7:21 [PATCH 0/3] Input: clear the wake IRQ on unbind Prasanth R
2026-11-25 7:21 ` [PATCH 1/3] Input: snvs_pwrkey - " Prasanth R
@ 2026-11-25 7:21 ` Prasanth R
2026-11-25 7:21 ` [PATCH 3/3] Input: da9063 " Prasanth R
2026-11-26 8:21 ` [PATCH 0/3] Input: " Dmitry Torokhov
3 siblings, 0 replies; 5+ messages in thread
From: Prasanth R @ 2026-11-25 7:21 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input
Cc: Hans de Goede, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Support Opensource, linux-arm-kernel, linux-sunxi, 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() is 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 devm_pm_set_wake_irq() so the wake IRQ is released on unbind.
Compile-tested only.
I used an AI assistant (Claude) to find this and write the change.
Fixes: b243018eafeb ("Input: sun4i-lradc-keys - add wakeup support")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/input/keyboard/sun4i-lradc-keys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c
index 05983db3f..eea04d27e 100644
--- a/drivers/input/keyboard/sun4i-lradc-keys.c
+++ b/drivers/input/keyboard/sun4i-lradc-keys.c
@@ -321,7 +321,7 @@ static int sun4i_lradc_probe(struct platform_device *pdev)
return error;
if (device_property_read_bool(dev, "wakeup-source")) {
- error = dev_pm_set_wake_irq(dev, irq);
+ error = devm_pm_set_wake_irq(dev, irq);
if (error)
dev_warn(dev,
"Failed to set IRQ %d as a wake IRQ: %d\n",
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] Input: da9063 - clear the wake IRQ on unbind
2026-11-25 7:21 [PATCH 0/3] Input: clear the wake IRQ on unbind Prasanth R
2026-11-25 7:21 ` [PATCH 1/3] Input: snvs_pwrkey - " Prasanth R
2026-11-25 7:21 ` [PATCH 2/3] Input: sun4i-lradc-keys " Prasanth R
@ 2026-11-25 7:21 ` Prasanth R
2026-11-26 8:21 ` [PATCH 0/3] Input: " Dmitry Torokhov
3 siblings, 0 replies; 5+ messages in thread
From: Prasanth R @ 2026-11-25 7:21 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input
Cc: Hans de Goede, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Support Opensource, linux-arm-kernel, linux-sunxi, 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 and does not enable
wakeup.
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: d7781232b5b2 ("Input: da9063 - add wakeup support")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
drivers/input/misc/da9063_onkey.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/da9063_onkey.c b/drivers/input/misc/da9063_onkey.c
index 98297ca1d..304fd674d 100644
--- a/drivers/input/misc/da9063_onkey.c
+++ b/drivers/input/misc/da9063_onkey.c
@@ -229,13 +229,13 @@ static int da9063_onkey_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, error,
"Failed to allocate onkey IRQ\n");
- error = dev_pm_set_wake_irq(&pdev->dev, irq);
+ error = devm_pm_set_wake_irq(&pdev->dev, irq);
if (error)
dev_warn(&pdev->dev,
"Failed to set IRQ %d as a wake IRQ: %d\n",
irq, error);
else
- device_init_wakeup(&pdev->dev, true);
+ devm_device_init_wakeup(&pdev->dev);
error = input_register_device(onkey->input);
if (error)
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] Input: clear the wake IRQ on unbind
2026-11-25 7:21 [PATCH 0/3] Input: clear the wake IRQ on unbind Prasanth R
` (2 preceding siblings ...)
2026-11-25 7:21 ` [PATCH 3/3] Input: da9063 " Prasanth R
@ 2026-11-26 8:21 ` Dmitry Torokhov
3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2026-11-26 8:21 UTC (permalink / raw)
To: Prasanth R
Cc: linux-input, Hans de Goede, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Support Opensource, linux-arm-kernel, linux-sunxi,
Rafael J. Wysocki, Pavel Machek, Len Brown, linux-pm,
Greg Kroah-Hartman, Danilo Krummrich, Johan Hovold, driver-core
Hi Prasanth,
On Wed, Nov 25, 2026 at 04:21:21PM +0900, Prasanth R wrote:
> 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.
>
> Switch them to the device-managed helpers.
Adding PM and driver core maintainers to the thread.
I wonder why clearing the wake IRQ cannot be done automatically for all
drivers on unbind, for example in device_unbind_cleanup() alongside
pm_runtime_reinit() and dev_pm_set_driver_flags().
The only case I see where a wake IRQ is attached at device registration
time rather than by a bound driver (or bus probe()) is PCI OF WAKE# in
drivers/pci/of.c:pci_configure_wake_irq(). That could be distinguished
by checking dev->driver when attaching the wake IRQ, or via an explicit
flag, so device_unbind_cleanup() only clears driver-bound wake IRQs.
Handling this in the core would save us from having to hunt down and
convert individual drivers to devm_pm_set_wake_irq() across the tree,
and would also fix buses like SPI that set up wake IRQs in probe() but
do not clear them on remove.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread