Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280535
b: refs/heads/master
c: 82cd996
h: refs/heads/master
i:
  280533: bd5e65b
  280531: 7b5afcc
  280527: b0a3f7b
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Nov 9, 2011
1 parent e1e2447 commit fe23510
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 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: 81bf58eb3c16302f19676e73dfe4d1832199c0ef
refs/heads/master: 82cd9965c37be7e2cbcb79ad991a6b9860f855d8
29 changes: 16 additions & 13 deletions trunk/drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ bool regmap_precious(struct regmap *map, unsigned int reg)
return false;
}

static bool regmap_volatile_range(struct regmap *map, unsigned int reg,
unsigned int num)
{
unsigned int i;

for (i = 0; i < num; i++)
if (!regmap_volatile(map, reg + i))
return false;

return true;
}

static void regmap_format_4_12_write(struct regmap *map,
unsigned int reg, unsigned int val)
{
Expand Down Expand Up @@ -483,15 +495,11 @@ 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;
int i;
bool vol = true;

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);
WARN_ON(!regmap_volatile_range(map, reg, val_count) &&
map->cache_type != REGCACHE_NONE);

mutex_lock(&map->lock);

Expand Down Expand Up @@ -519,16 +527,11 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
{
int ret, i;
size_t val_bytes = map->format.val_bytes;
bool vol = true;
bool vol = regmap_volatile_range(map, reg, val_count);

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

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

if (vol || map->cache_type == REGCACHE_NONE) {
ret = regmap_raw_read(map, reg, val, val_bytes * val_count);
if (ret != 0)
Expand Down

0 comments on commit fe23510

Please sign in to comment.