Skip to contentSkip to conversation

regmap: cache: Step by stride in default sync.

PATCH Applied Dylan Reid 2 participants 4 messages Mar 18, 2014 – Mar 19, 2014

Subsystems (2)
lore
Share & tools
lore

Dylan Reid

author
#0 lore raw

PATCH 1/2 regmap: cache: Step by stride in default sync.

The default sync operation was still assuming a stride of one, fix it to respect the reg_stride set in the map.

---
 drivers/base/regmap/regcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regcache.c +1 -1
index c6b1ac1..44af125 100644
@@ -249,7 +249,7 @@ static int regcache_default_sync(struct regmap *map, unsigned int min,
 {
 	unsigned int reg;
 
-	for (reg = min; reg <= max; reg++) {
+	for (reg = min; reg <= max; reg += map->reg_stride) {
 		unsigned int val;
 		int ret;
 
Signature · 1 line
1.8.1.3.605.g02339dd
author
#1 lore raw

PATCH 2/2 regmap: cache: Don't attempt to sync non-writeable registers.

In the regcache_default_sync, if a register isn't writeable, then _regmap_write will return an error and the rest of the sync will be aborted. Avoid this by checking if a register is writeable before trying to sync it.

---
 drivers/base/regmap/regcache.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/regmap/regcache.c +2 -1
index 44af125..29b4128 100644
@@ -253,7 +253,8 @@ static int regcache_default_sync(struct regmap *map, unsigned int min,
 		unsigned int val;
 		int ret;
 
-		if (regmap_volatile(map, reg))
+		if (regmap_volatile(map, reg) ||
+		    !regmap_writeable(map, reg))
 			continue;
 
 		ret = regcache_read(map, reg, &val);
Signature · 1 line
1.8.1.3.605.g02339dd
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] regmap: cache: Don't attempt to sync non-writeable registers.

Quoted 4 lines · Dylan Reid

In the regcache_default_sync, if a register isn't writeable, then _regmap_write will return an error and the rest of the sync will be aborted. Avoid this by checking if a register is writeable before trying to sync it.

Applied, thanks.

maintainer Applied
#3 lore raw
In reply to Dylan Reid
Quoted 2 lines · Dylan Reid

The default sync operation was still assuming a stride of one, fix it to respect the reg_stride set in the map.

Applied, thanks.