[PATCH 12/12] rtc: rv8803: clear the wake IRQ on unbind

Prasanth R ragaprasanth at gmail.com
Tue Nov 24 23:20:26 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 "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 at 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




More information about the linux-arm-kernel mailing list