aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regcache.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-25 16:05:48 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-25 16:22:05 -0500
commit8a892d6996b60c822f19ad1844eb15b96ce393c7 (patch)
treee3b2281798d9188cb69f21ff9d965d1073a69957 /drivers/base/regmap/regcache.c
parentd9db762708e27c2892db9d8a54e735a8e506e16e (diff)
regmap: Bypass the cache when applying patches
Otherwise any patch that affects a register which is writable may trash cached values. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regcache.c')
-rw-r--r--drivers/base/regmap/regcache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 9c6a5c13f1da..ee36bed9479c 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -273,6 +273,7 @@ int regcache_sync(struct regmap *map)
273 goto out; 273 goto out;
274 274
275 /* Apply any patch first */ 275 /* Apply any patch first */
276 map->cache_bypass = 1;
276 for (i = 0; i < map->patch_regs; i++) { 277 for (i = 0; i < map->patch_regs; i++) {
277 ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def); 278 ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def);
278 if (ret != 0) { 279 if (ret != 0) {
@@ -281,6 +282,7 @@ int regcache_sync(struct regmap *map)
281 goto out; 282 goto out;
282 } 283 }
283 } 284 }
285 map->cache_bypass = 0;
284 286
285 if (map->cache_ops->sync) { 287 if (map->cache_ops->sync) {
286 ret = map->cache_ops->sync(map); 288 ret = map->cache_ops->sync(map);