The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] gpio: pca953x: restore cache_only state on resume failure
@ 2026-07-24  8:18 phucduc.bui
  2026-07-24 10:21 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: phucduc.bui @ 2026-07-24  8:18 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, linux-gpio; +Cc: linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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().

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/gpio/gpio-pca953x.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index f6b870b7b352..0c94630f3160 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -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)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpio: pca953x: restore cache_only state on resume failure
  2026-07-24  8:18 [PATCH] gpio: pca953x: restore cache_only state on resume failure phucduc.bui
@ 2026-07-24 10:21 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2026-07-24 10:21 UTC (permalink / raw)
  To: phucduc.bui; +Cc: linux-kernel, Linus Walleij, Bartosz Golaszewski, linux-gpio

On Fri, 24 Jul 2026 10:18:38 +0200, phucduc.bui@gmail.com said:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> 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().
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---

Fixes: and Cc: stable?

Bart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-24 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-24  8:18 [PATCH] gpio: pca953x: restore cache_only state on resume failure phucduc.bui
2026-07-24 10:21 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox