Skip to content

Commit

Permalink
regmap: rbtree: Fix register default look-up in sync
Browse files Browse the repository at this point in the history
The code currently passes the register offset in the current block to
regcache_lookup_reg. This works fine as long as there is only one block and with
base register of 0, but in all other cases it will look-up the default for a
wrong register, which can cause unnecessary register writes. This patch fixes
it by passing the actual register number to regcache_lookup_reg.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: <stable@vger.kernel.org>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Apr 1, 2012
1 parent dd775ae commit 4b4e9e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/regmap/regcache-rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
map->cache_word_size);

/* Is this the hardware default? If so skip. */
ret = regcache_lookup_reg(map, i);
ret = regcache_lookup_reg(map, regtmp);
if (ret >= 0 && val == map->reg_defaults[ret].def)
continue;

Expand Down

0 comments on commit 4b4e9e4

Please sign in to comment.