Skip to contentSkip to conversation

gpio: pca953x: restore cache_only state on resume failure

PATCH In review [email protected] 3 participants 4 messages Jul 24 – Jul 27 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: pca953x: restore cache_only state on resume failure

From: bui duc phuc <[email protected]>

When pca953x_restore_context() fails, cache_only is left disabled and the IRQ left enabled, even though register synchronization may not have completed successfully. Restore cache_only and disable the IRQ again on failure, matching the state set by pca953x_save_context().

---
 drivers/gpio/gpio-pca953x.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/gpio/gpio-pca953x.c +13 -2
index f6b870b7b352..0c94630f3160 100644
@@ -1369,9 +1369,20 @@ static int pca953x_restore_context(struct pca953x_chip *chip)
 	regcache_mark_dirty(chip->regmap);
 	ret = pca953x_regcache_sync(chip);
 	if (ret)
-		return ret;
+		goto err;
+
+	ret = regcache_sync(chip->regmap);
+	if (ret)
+		goto err;
+
+	return 0;
 
-	return regcache_sync(chip->regmap);
+err:
+	if (chip->client->irq > 0)
+		disable_irq(chip->client->irq);
+	regcache_cache_only(chip->regmap, true);
+
+	return ret;
 }
 
 static void pca953x_save_context(struct pca953x_chip *chip)
Signature · 1 line
2.43.0
#1 lore raw
Quoted 9 lines · On Fri, 24 Jul 2026 10:18:38 +0200, [email protected] said:

From: bui duc phuc <[email protected]>

When pca953x_restore_context() fails, cache_only is left disabled and the IRQ left enabled, even though register synchronization may not have completed successfully. Restore cache_only and disable the IRQ again on failure, matching the state set by pca953x_save_context().

---

Fixes and Cc: stable?

Bart

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 8 lines · On Fri, Jul 24, 2026 at 10:18 AM <[email protected]> wrote:

From: bui duc phuc <[email protected]>

When pca953x_restore_context() fails, cache_only is left disabled and the IRQ left enabled, even though register synchronization may not have completed successfully. Restore cache_only and disable the IRQ again on failure, matching the state set by pca953x_save_context().

Yours,
Linus Walleij

#3 lore raw

Hi Bart, Linus,

Thank you both for the reviews.
I'll send a v2 shortly.

Best regards,
Phuc