Skip to content

Commit

Permalink
regmap: Skip hardware defaults for LZO caches
Browse files Browse the repository at this point in the history
Saves some I/O when resyncing; we assume that syncs start from the device
reset state.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Feb 23, 2012
1 parent f0c2319 commit a3c3774
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/base/regmap/regcache-lzo.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ static int regcache_lzo_sync(struct regmap *map)
ret = regcache_read(map, i, &val);
if (ret)
return ret;

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

map->cache_bypass = 1;
ret = _regmap_write(map, i, val);
map->cache_bypass = 0;
Expand Down

0 comments on commit a3c3774

Please sign in to comment.