regmap: maple: Don't sync read-only registers
Subsystems (2)
PATCH 1/1 regmap: maple: 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 in the loop for addressing the bug.
--- drivers/base/regmap/regcache-maple.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/regmap/regcache-maple.c +2 -0
@@ -203,6 +203,8 @@ static int regcache_maple_sync(struct regmap *map, unsigned int min,mas_for_each (&mas, entry, max) {for (r =max (mas.index, lmin); r <=min (mas.last, lmax); r++) { +if (!regmap_writeable (map, r)) +continue ;mas_pause (&mas);rcu_read_unlock (); ret =regcache_sync_val (map, r, entry[r - mas.index]);
Signature · 1 line
2.35.3
Mark Brown
maintainerQuoted 9 lines · Takashi Iwai
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-EIOfor a read-only register. This results in an error message like:
snd_hda_codec_realtekhdaudioC0D0: Unable to sync register0x2f0009. -5
and the sync loop is aborted incompletely.This patch adds the writable register check in the loop for addressing the bug.
This should be in _needs_sync().
Quoted 9 lines · Mark Brown
Quoted 7 lines · Takashi Iwai
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-EIOfor a read-only register. This results in an error message like:
snd_hda_codec_realtekhdaudioC0D0: Unable to sync register0x2f0009. -5
and the sync loop is aborted incompletely.
Quoted 4 lines
Quoted 2 lines
This patch adds the writable register check in the loop for addressing the bug.
This should be in
_needs_sync().
I thought it's a different logic? regacahe_reg_needs_sync() checks only whether it's a default value, and other call paths already check regmap_writeable().
But I can put the check there instead if you still prefer, too.
thanks,
Takashi
Mark Brown
maintainerQuoted 8 lines · Takashi Iwai
Quoted 3 lines · Mark Brown
On Tue, Jun 13, 2023 at 09:45:11AM +0200, Takashi Iwai wrote:
This should be in
_needs_sync().I thought it's a different logic?
regacahe_reg_needs_sync()checks only whether it's a default value, and other call paths already checkregmap_writeable().
Yeah, but it feels like that's the reason we ran into this issue given that you'd expect _needs_sync() to check this too.
Quoted 1 line
But I can put the check there instead if you still prefer, too.
It should avoid any similar issues in future.
Quoted 11 lines · Mark Brown
Quoted 8 lines · Takashi Iwai
Quoted 3 lines · Mark Brown
On Tue, Jun 13, 2023 at 09:45:11AM +0200, Takashi Iwai wrote:
This should be in
_needs_sync().I thought it's a different logic?
regacahe_reg_needs_sync()checks only whether it's a default value, and other call paths already checkregmap_writeable().
Quoted 6 lines
Yeah, but it feels like that's the reason we ran into this issue given that you'd expect
_needs_sync()to check this too.Quoted 1 line
But I can put the check there instead if you still prefer, too.
It should avoid any similar issues in future.
OK, then let me cook the v2.
Takashi