[PATCH 1/3] Input: snvs_pwrkey - clear the wake IRQ on unbind

Prasanth R ragaprasanth at gmail.com
Tue Nov 24 23:21:22 PST 2026


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 "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 at 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




More information about the linux-arm-kernel mailing list