Browse Source

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.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Dylan Reid 11 years ago
parent
commit
83f8475ce9
1 changed files with 2 additions and 1 deletions
  1. 2 1
      drivers/base/regmap/regcache.c

+ 2 - 1
drivers/base/regmap/regcache.c

@@ -253,7 +253,8 @@ static int regcache_default_sync(struct regmap *map, unsigned int min,
 		unsigned int val;
 		unsigned int val;
 		int ret;
 		int ret;
 
 
-		if (regmap_volatile(map, reg))
+		if (regmap_volatile(map, reg) ||
+		    !regmap_writeable(map, reg))
 			continue;
 			continue;
 
 
 		ret = regcache_read(map, reg, &val);
 		ret = regcache_read(map, reg, &val);