Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294173
b: refs/heads/master
c: ac8d91c
h: refs/heads/master
i:
  294171: b93d5b6
v: v3
  • Loading branch information
Mark Brown committed Feb 24, 2012
1 parent 09306f9 commit f92d1b1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6ff7373809a9b4eb644d83e2e299da297e1cbffa
refs/heads/master: ac8d91c801905a061ca883dca427a5e19602a1e7
2 changes: 1 addition & 1 deletion trunk/drivers/base/regmap/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct regcache_ops {
int (*exit)(struct regmap *map);
int (*read)(struct regmap *map, unsigned int reg, unsigned int *value);
int (*write)(struct regmap *map, unsigned int reg, unsigned int value);
int (*sync)(struct regmap *map);
int (*sync)(struct regmap *map, unsigned int min, unsigned int max);
};

bool regmap_writeable(struct regmap *map, unsigned int reg);
Expand Down
10 changes: 8 additions & 2 deletions trunk/drivers/base/regmap/regcache-lzo.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,21 @@ static int regcache_lzo_write(struct regmap *map,
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;
int i;
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;
Expand Down
25 changes: 22 additions & 3 deletions trunk/drivers/base/regmap/regcache-rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,20 +357,39 @@ 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;
struct regcache_rbtree_node *rbnode;
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 + rbnode->blklen)
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);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/base/regmap/regcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ int regcache_sync(struct regmap *map)
}
map->cache_bypass = 0;

ret = map->cache_ops->sync(map);
ret = map->cache_ops->sync(map, 0, map->max_register);

if (ret == 0)
map->cache_dirty = false;
Expand Down

0 comments on commit f92d1b1

Please sign in to comment.