Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294146
b: refs/heads/master
c: b8fb5ab
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Feb 21, 2012
1 parent 62fe329 commit 87ae0fd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 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: 7d5e525b9ceda0e3b85da0acdaa2de19fea51edc
refs/heads/master: b8fb5ab156055b745254609f4635fcfd6b7dabc8
28 changes: 22 additions & 6 deletions trunk/drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,16 +604,32 @@ EXPORT_SYMBOL_GPL(regmap_read);
int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
size_t val_len)
{
size_t val_count = val_len / map->format.val_bytes;
int ret;

WARN_ON(!regmap_volatile_range(map, reg, val_count) &&
map->cache_type != REGCACHE_NONE);
size_t val_bytes = map->format.val_bytes;
size_t val_count = val_len / val_bytes;
unsigned int v;
int ret, i;

mutex_lock(&map->lock);

ret = _regmap_raw_read(map, reg, val, val_len);
if (regmap_volatile_range(map, reg, val_count) || map->cache_bypass ||
map->cache_type == REGCACHE_NONE) {
/* Physical block read if there's no cache involved */
ret = _regmap_raw_read(map, reg, val, val_len);

} else {
/* Otherwise go word by word for the cache; should be low
* cost as we expect to hit the cache.
*/
for (i = 0; i < val_count; i++) {
ret = _regmap_read(map, reg + i, &v);
if (ret != 0)
goto out;

map->format.format_val(val + (i * val_bytes), v);
}
}

out:
mutex_unlock(&map->lock);

return ret;
Expand Down

0 comments on commit 87ae0fd

Please sign in to comment.