Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
regmap: Cache single values read from the chip
Browse files Browse the repository at this point in the history
If we don't have a cached value for a register and we can cache it then
when we do a read a value we should add it to the cache to save rereading
it later on. Do this for single register reads, for block reads the code
would be a little more complex and this covers most practical usage.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
broonie committed Apr 30, 2012
1 parent d939fb9 commit f298536
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,9 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
trace_regmap_reg_read(map->dev, reg, *val);
}

if (ret == 0 && !map->cache_bypass)
regcache_write(map, reg, *val);

return ret;
}

Expand Down

0 comments on commit f298536

Please sign in to comment.