summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-02-15 10:23:25 +0100
committerLokesh Pathak <lpathak@nvidia.com>2012-03-05 08:01:12 -0800
commit27eb5ab7eb04b7d83b62f557f05b10b14117af3b (patch)
tree9cf4d9d21f2d1c71e14e0b975eded28468e18845 /drivers/base
parent7f97efd8b1e6fe8c5cd2173a3e447a7867fffaf6 (diff)
regmap: Fix cache defaults initialization from raw cache defaults
Currently registers with a value of 0 are ignored when initializing the register defaults from raw defaults. This worked in the past, because registers without a explicit default were assumed to have a default value of 0. This was changed in commit b03622a8 ("regmap: Ensure rbtree syncs registers set to zero properly"). As a result registers, which have a raw default value of 0 are now assumed to have no default. This again can result in unnecessary writes when syncing the cache. It will also result in unnecessary reads for e.g. the first update operation. In the case where readback is not possible this will even let the update operation fail, if the register has not been written to before. So this patch removes the check. Instead it adds a check to ignore raw defaults for registers which are volatile, since those registers are not cached. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org (cherry picked from commit 61cddc57dc14a5dffa0921d9a24fd68edbb374ac) Change-Id: Iccd58a95a432d222befd8b339fe0c6edd26666bb Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87592
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index d46856f45866..43ffcc312b44 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -52,7 +52,7 @@ static int regcache_hw_init(struct regmap *map)
for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) {
val = regcache_get_val(map->reg_defaults_raw,
i, map->cache_word_size);
- if (!val)
+ if (regmap_volatile(map, i))
continue;
count++;
}
@@ -69,7 +69,7 @@ static int regcache_hw_init(struct regmap *map)
for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) {
val = regcache_get_val(map->reg_defaults_raw,
i, map->cache_word_size);
- if (!val)
+ if (regmap_volatile(map, i))
continue;
map->reg_defaults[j].reg = i;
map->reg_defaults[j].def = val;