clk: versaclock5: restore cache_only on regcache_sync() failure in resume
Subsystems (2)
PATCH 1/1 clk: versaclock5: restore cache_only on regcache_sync() failure in resume
From: bui duc phuc <[email protected]>
If regcache_sync() fails in vc5_resume(), the function only logs the error, leaving regmap with cache_only disabled even though the register cache has not been synchronized with the hardware.
Re-enable cache_only on failure to restore the state established by vc5_suspend().
--- drivers/clk/clk-versaclock5.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/clk-versaclock5.c +3 -1
@@ -1240,8 +1240,10 @@ static int __maybe_unused vc5_resume(struct device *dev)regcache_cache_only (vc5->regmap, false); ret =regcache_sync (vc5->regmap); -if (ret) +if (ret) { +regcache_cache_only (vc5->regmap, true);dev_err (dev,"Failed to restore register map: %d\n" , ret); + }return ret; }
Signature · 1 line
2.43.0
Hi bui,
Quoted 18 lines · On Fri, Jul 24, 2026 at 02:46:03PM +0700, [email protected] wrote:
From: bui duc phuc <[email protected]>
If
regcache_sync()fails invc5_resume(), the function only logs the error, leaving regmap withcache_onlydisabled even though the register cache has not been synchronized with the hardware.
Re-enablecache_onlyon failure to restore the state established byvc5_suspend().Signed-off-by bui duc phuc <[email protected]>--- drivers/clk/clk-versaclock5.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/clk/clk-versaclock5.c +0
-0
drivers/clk/clk-versaclock5.c static int __maybe_unused vc5_resume(struct device *dev) · line 1248
Quoted 10 lines
drivers/clk/clk-versaclock5.c +3
-1@@ -1240,8 +1240,10 @@ static int __maybe_unused vc5_resume(struct device *dev)regcache_cache_only (vc5->regmap, false); ret =regcache_sync (vc5->regmap); -if (ret) +if (ret) { +regcache_cache_only (vc5->regmap, true);dev_err (dev,"Failed to restore register map: %d\n" , ret); + }return ret; }
I don't see precedent for this pattern anywhere else in the tree. Is this an observed problem or something that could theoretically happen?
If this fails in the code today, the pm core will propagate the error, and the device won't be marked as resumed.
Brian
Hi Brian,
Thank you for your feedback.
Quoted 6 lines
I don't see precedent for this pattern anywhere else in the tree. Is this an observed problem or something that could theoretically happen?
If this fails in the code today, the pm core will propagate the error, and the device won't be marked as resumed.
Fair point, there's no precedent in system sleep PM,
though runtime PM has a few cases doing the same thing, so it's not an entirely new pattern.
This is a defensive fix for a theoretical case; I don't have an actual bug report for it.
But after a failed resume, what guarantees that no further regmap accesses can occur
before the next successful resume? If there is such a guarantee, I'm happy to drop the patch ,
otherwise I'd lean towards keeping it.
Best regards,
Phuc
Brian Masney
AppliedQuoted 1 line · On Fri, 24 Jul 2026 14:46:03 +0700, [email protected] wrote:
clk: versaclock5: restore
cache_onlyonregcache_sync()failure in resume
Applied, thanks!
[1/1] clk: versaclock5: restore cache_only on regcache_sync() failure in resume
commit: 7b283b8ce37d40d22f41bdc20b407cd76fe86e68
Best regards,
Signature · 1 line
Brian Masney <[email protected]>