Skip to content

Commit 44e4657

Browse files
tiwaibroonie
authored andcommitted
regmap: regcache: Don't sync read-only registers
regcache_maple_sync() tries to sync all cached values no matter whether it's writable or not. OTOH, regache_sync_val() does care the wrtability and returns -EIO for a read-only register. This results in an error message like: snd_hda_codec_realtek hdaudioC0D0: Unable to sync register 0x2f0009. -5 and the sync loop is aborted incompletely. This patch adds the writable register check to regcache_sync_val() for addressing the bug above. Note that, although we may add the check in the caller side (regcache_maple_sync()), here we put in regcache_sync_val(), so that a similar case like this can be avoided in future. Fixes: f033c26 ("regmap: Add maple tree based register cache") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 0cc6578 commit 44e4657

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/base/regmap/regcache.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ static bool regcache_reg_needs_sync(struct regmap *map, unsigned int reg,
284284
{
285285
int ret;
286286

287+
if (!regmap_writeable(map, reg))
288+
return false;
289+
287290
/* If we don't know the chip just got reset, then sync everything. */
288291
if (!map->no_sync_defaults)
289292
return true;

0 commit comments

Comments
 (0)