summaryrefslogtreecommitdiff
path: root/drivers/base/regmap/regcache-rbtree.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-14 17:14:24 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-14 17:14:24 +0400
commit4a6be7bb7474500a69f6d8f25899b8038491bdbb (patch)
treea2645b0f707fcf1ea94a9e7ef7a59b298fb5ecac /drivers/base/regmap/regcache-rbtree.c
parent7d9aca39dcacd2b3f42e2e287162329f410f93e1 (diff)
parentf9353e70bcebd00cd182d946083afd7d8eddd259 (diff)
downloadlinux-4a6be7bb7474500a69f6d8f25899b8038491bdbb.tar.xz
Merge remote-tracking branches 'regmap/topic/patch' and 'regmap/topic/sync' into regmap-next
Diffstat (limited to 'drivers/base/regmap/regcache-rbtree.c')
-rw-r--r--drivers/base/regmap/regcache-rbtree.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 861ad2c81dff..8d51916a283d 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -357,7 +357,8 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg,
return 0;
}
-static int regcache_rbtree_sync(struct regmap *map)
+static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
+ unsigned int max)
{
struct regcache_rbtree_ctx *rbtree_ctx;
struct rb_node *node;
@@ -365,12 +366,30 @@ static int regcache_rbtree_sync(struct regmap *map)
unsigned int regtmp;
unsigned int val;
int ret;
- int i;
+ int i, base, end;
rbtree_ctx = map->cache;
for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) {
rbnode = rb_entry(node, struct regcache_rbtree_node, node);
- for (i = 0; i < rbnode->blklen; i++) {
+
+ if (rbnode->base_reg < min)
+ continue;
+ if (rbnode->base_reg > max)
+ break;
+ if (rbnode->base_reg + rbnode->blklen < min)
+ continue;
+
+ if (min > rbnode->base_reg)
+ base = min - rbnode->base_reg;
+ else
+ base = 0;
+
+ if (max < rbnode->base_reg + rbnode->blklen)
+ end = rbnode->base_reg + rbnode->blklen - max;
+ else
+ end = rbnode->blklen;
+
+ for (i = base; i < end; i++) {
regtmp = rbnode->base_reg + i;
val = regcache_rbtree_get_register(rbnode, i,
map->cache_word_size);