Re: [PATCH] regcache: disable cache_only before rewriting paging registers

From: Bui Duc Phuc

Date: Mon Jul 13 2026 - 11:08:25 EST


Hi Mark,

Thanks for the clarification.

>
> Yes, calling regcache_sync() with the cache enabled is not particularly
> sensible - it basically exists to put all the changes made while a
> device was in cache only mode (including due to suspend which is the
> main case for that) onto the device.

That was actually my understanding as well. Initially, I was considering a
patch that would make it unnecessary to explicitly call
regcache_cache_only(map, true) again when regcache_sync() fails.

The idea was roughly:
1. check cache_only at the beginning of regcache_sync(), and if it is
already true, emit a warning and return immediately;
2. if regcache_sync() fails, automatically restore cache_only = true
before returning.

However, after reviewing the existing users of regcache_sync(), I found
that there are several drivers that call regcache_sync() without first calling
regcache_cache_only(map, false). That made me think such a change
could break existing users, so I decided not to pursue that approach.

If the intended usage is indeed that regcache_cache_only(map, false) should
always be set before regcache_sync() is ever used, then I'm happy to revisit
this approach and also prepare follow-up patches for the drivers that don't
currently follow that pattern.

I'd appreciate your thoughts on whether that would be the right direction.

Best regards,
Phuc