Skip to content

Commit

Permalink
regmap: Bypass the cache when applying patches
Browse files Browse the repository at this point in the history
Otherwise any patch that affects a register which is writable may trash
cached values.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Jan 25, 2012
1 parent d9db762 commit 8a892d6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/base/regmap/regcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ int regcache_sync(struct regmap *map)
goto out;

/* Apply any patch first */
map->cache_bypass = 1;
for (i = 0; i < map->patch_regs; i++) {
ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def);
if (ret != 0) {
Expand All @@ -281,6 +282,7 @@ int regcache_sync(struct regmap *map)
goto out;
}
}
map->cache_bypass = 0;

if (map->cache_ops->sync) {
ret = map->cache_ops->sync(map);
Expand Down

0 comments on commit 8a892d6

Please sign in to comment.