aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regcache-lzo.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/regmap/regcache-lzo.c')
-rw-r--r--drivers/base/regmap/regcache-lzo.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c
index b7d16143edeb..8d0061569326 100644
--- a/drivers/base/regmap/regcache-lzo.c
+++ b/drivers/base/regmap/regcache-lzo.c
@@ -331,7 +331,8 @@ out:
331 return ret; 331 return ret;
332} 332}
333 333
334static int regcache_lzo_sync(struct regmap *map) 334static int regcache_lzo_sync(struct regmap *map, unsigned int min,
335 unsigned int max)
335{ 336{
336 struct regcache_lzo_ctx **lzo_blocks; 337 struct regcache_lzo_ctx **lzo_blocks;
337 unsigned int val; 338 unsigned int val;
@@ -339,10 +340,21 @@ static int regcache_lzo_sync(struct regmap *map)
339 int ret; 340 int ret;
340 341
341 lzo_blocks = map->cache; 342 lzo_blocks = map->cache;
342 for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) { 343 i = min;
344 for_each_set_bit_cont(i, lzo_blocks[0]->sync_bmp,
345 lzo_blocks[0]->sync_bmp_nbits) {
346 if (i > max)
347 continue;
348
343 ret = regcache_read(map, i, &val); 349 ret = regcache_read(map, i, &val);
344 if (ret) 350 if (ret)
345 return ret; 351 return ret;
352
353 /* Is this the hardware default? If so skip. */
354 ret = regcache_lookup_reg(map, i);
355 if (ret > 0 && val == map->reg_defaults[ret].def)
356 continue;
357
346 map->cache_bypass = 1; 358 map->cache_bypass = 1;
347 ret = _regmap_write(map, i, val); 359 ret = _regmap_write(map, i, val);
348 map->cache_bypass = 0; 360 map->cache_bypass = 0;