Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 267017
b: refs/heads/master
c: de2d808
h: refs/heads/master
i:
  267015: eebdf46
v: v3
  • Loading branch information
Mark Brown committed Oct 13, 2011
1 parent 570fb4e commit 77acba8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 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: 8528bdd450d34687b380c0f87992d105bdf54ca3
refs/heads/master: de2d808f4de091321978d05a85ef0819e8f3561a
34 changes: 26 additions & 8 deletions trunk/drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,14 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
size_t val_len)
{
int ret;
int i;
bool vol = true;

WARN_ON(map->cache_type != REGCACHE_NONE);
for (i = 0; i < val_len / map->format.val_bytes; i++)
if (!regmap_volatile(map, reg + i))
vol = false;

WARN_ON(!vol && map->cache_type != REGCACHE_NONE);

mutex_lock(&map->lock);

Expand Down Expand Up @@ -511,18 +517,30 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
{
int ret, i;
size_t val_bytes = map->format.val_bytes;

WARN_ON(map->cache_type != REGCACHE_NONE);
bool vol = true;

if (!map->format.parse_val)
return -EINVAL;

ret = regmap_raw_read(map, reg, val, val_bytes * val_count);
if (ret != 0)
return ret;
/* Is this a block of volatile registers? */
for (i = 0; i < val_count; i++)
if (!regmap_volatile(map, reg + i))
vol = false;

for (i = 0; i < val_count * val_bytes; i += val_bytes)
map->format.parse_val(val + i);
if (vol || map->cache_type == REGCACHE_NONE) {
ret = regmap_raw_read(map, reg, val, val_bytes * val_count);
if (ret != 0)
return ret;

for (i = 0; i < val_count * val_bytes; i += val_bytes)
map->format.parse_val(val + i);
} else {
for (i = 0; i < val_count; i++) {
ret = regmap_read(map, reg + i, val + (i * val_bytes));
if (ret != 0)
return ret;
}
}

return 0;
}
Expand Down

0 comments on commit 77acba8

Please sign in to comment.