Re: [PATCH] regcache: Warn if regcache_sync() is called in cache_only mode
From: Bui Duc Phuc
Date: Thu Jul 16 2026 - 06:09:19 EST
Hi Mark,
Thank you for your review.
>
> The check needs to be done under lock otherwise some other thread could
> come in and put the regmap into cache only mode between the check and
> when we take the lock.
>
> We also need a similar check in regcache_sync_region().
I'll move the check under the lock for v2, and add the same check to
regcache_sync_region() as well.
On top of that, I'd like to ask about a design question:
Should regcache_sync() set map->cache_only = true again if it fails
partway through,
or should we leave it to the caller to call regcache_cache_only() themselves?
If we leave it to the caller, should we also update the function's
documentation
to make clear that after a failed sync, the state of the registers is no longer
guaranteed to match the cache, and that further register access should be
done carefully , and that calling regcache_cache_only() is recommended to
keep the device in a safe/consistent state?
Best regards,
Phuc