Skip to content

Commit

Permalink
regmap: Try cached read before checking if a hardware read is possible
Browse files Browse the repository at this point in the history
For some register format types we do not provide a parse_val so we can not do a
hardware read. But a cached read is still possible, so try to read from the
cache first, before checking whether a hardware read is possible. Otherwise the
cache becomes pretty useless for these register types.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Nov 16, 2011
1 parent 720e461 commit 1925441
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,15 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
{
int ret;

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

if (!map->cache_bypass) {
ret = regcache_read(map, reg, val);
if (ret == 0)
return 0;
}

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

if (map->cache_only)
return -EBUSY;

Expand Down

0 comments on commit 1925441

Please sign in to comment.