Skip to content

Commit

Permalink
regmap: Skip patch application when the cache is not dirty on sync
Browse files Browse the repository at this point in the history
On the basis that if we don't actually need to resync the cache then the
patches are probably also already applied.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Jan 25, 2012
1 parent 22f0d90 commit d9db762
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/base/regmap/regcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ int regcache_sync(struct regmap *map)
name = map->cache_ops->name;
trace_regcache_sync(map->dev, name, "start");

if (!map->cache_dirty)
goto out;

/* Apply any patch first */
for (i = 0; i < map->patch_regs; i++) {
ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def);
Expand All @@ -279,8 +282,6 @@ int regcache_sync(struct regmap *map)
}
}

if (!map->cache_dirty)
goto out;
if (map->cache_ops->sync) {
ret = map->cache_ops->sync(map);
} else {
Expand Down

0 comments on commit d9db762

Please sign in to comment.