summaryrefslogtreecommitdiff
path: root/drivers/base/regmap/regcache-lzo.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-23 19:31:04 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-24 14:52:40 +0000
commitac8d91c801905a061ca883dca427a5e19602a1e7 (patch)
tree3b715a8aa18db4ed553811595c113ef95e1c5f75 /drivers/base/regmap/regcache-lzo.c
parent6ff7373809a9b4eb644d83e2e299da297e1cbffa (diff)
regmap: Supply ranges to the sync operations
In order to allow us to support partial sync operations add minimum and maximum register arguments to the sync operation and update the rbtree and lzo caches to use this new information. The LZO implementation is obviously not good, we could exit the iteration earlier, but there may be room for more wide reaching optimisation there. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regcache-lzo.c')
-rw-r--r--drivers/base/regmap/regcache-lzo.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c
index b7d16143edeb..5e964e9b2bab 100644
--- a/drivers/base/regmap/regcache-lzo.c
+++ b/drivers/base/regmap/regcache-lzo.c
@@ -331,7 +331,8 @@ out:
return ret;
}
-static int regcache_lzo_sync(struct regmap *map)
+static int regcache_lzo_sync(struct regmap *map, unsigned int min,
+ unsigned int max)
{
struct regcache_lzo_ctx **lzo_blocks;
unsigned int val;
@@ -339,7 +340,12 @@ static int regcache_lzo_sync(struct regmap *map)
int ret;
lzo_blocks = map->cache;
- for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
+ i = min;
+ for_each_set_bit_from(i, lzo_blocks[0]->sync_bmp,
+ lzo_blocks[0]->sync_bmp_nbits) {
+ if (i > max)
+ continue;
+
ret = regcache_read(map, i, &val);
if (ret)
return ret;