Skip to contentSkip to conversation

regmap: Skip read-only registers in regcache_sync()

PATCH Applied Takashi Iwai 2 participants 2 messages Mar 4, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 regmap: Skip read-only registers in regcache_sync()

regcache_sync() spews warnings when a value was cached for a read-only register as it tries to write all registers no matter whether they are writable or not. This patch adds regmap_wrtieable() checks for avoiding it in regcache_sync_block_single() and regcache_block_raw().

---
v1->v2: call regmap_writeable() at the place regcache_reg_preset() is called
also fix regcache_sync_block_raw()

 drivers/base/regmap/regcache.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/base/regmap/regcache.c +4 -2
index f373c35f9e1d..da84f544c544 100644
@@ -608,7 +608,8 @@ static int regcache_sync_block_single(struct regmap *map, void *block,
 	for (i = start; i < end; i++) {
 		regtmp = block_base + (i * map->reg_stride);
 
-		if (!regcache_reg_present(cache_present, i))
+		if (!regcache_reg_present(cache_present, i) ||
+		    !regmap_writeable(map, regtmp))
 			continue;
 
 		val = regcache_get_val(map, block, i);
@@ -677,7 +678,8 @@ static int regcache_sync_block_raw(struct regmap *map, void *block,
 	for (i = start; i < end; i++) {
 		regtmp = block_base + (i * map->reg_stride);
 
-		if (!regcache_reg_present(cache_present, i)) {
+		if (!regcache_reg_present(cache_present, i) ||
+		    !regmap_writeable(map, regtmp)) {
 			ret = regcache_sync_block_raw_flush(map, &data,
 							    base, regtmp);
 			if (ret != 0)
Signature · 1 line
2.3.1
maintainer Applied
#1 lore raw
Quoted 4 lines · Takashi Iwai

regcache_sync() spews warnings when a value was cached for a read-only register as it tries to write all registers no matter whether they are writable or not. This patch adds regmap_wrtieable() checks for avoiding it in regcache_sync_block_single() and regcache_block_raw().

Applied, thanks!