[PATCH 1/2] regmap: Bypass the cache when applying patches

From: Mark Brown
Date: Wed Jan 25 2012 - 16:07:28 EST


Otherwise any patch that affects a register which is writable may trash
cached values.

Signed-off-by: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
---
drivers/base/regmap/regcache.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 0d54668..bfe48e4 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -268,6 +268,7 @@ int regcache_sync(struct regmap *map)
trace_regcache_sync(map->dev, name, "start");

/* 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) {
@@ -276,6 +277,7 @@ int regcache_sync(struct regmap *map)
goto out;
}
}
+ map->cache_bypass = 0;

if (!map->cache_dirty)
goto out;
--
1.7.9.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/