aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2011-11-16 16:28:19 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-16 17:34:53 +0000
commit19254411db4e69d90958244c5017e7e4a38547b0 (patch)
treefd45ca553cb7aef1c4665b6a28df92818d8ce507 /drivers/base/regmap
parent720e4616e8fd85284ef1addd8b8d93d8415e8dbc (diff)
downloadkernel_goldelico_gta04-19254411db4e69d90958244c5017e7e4a38547b0.zip
kernel_goldelico_gta04-19254411db4e69d90958244c5017e7e4a38547b0.tar.gz
kernel_goldelico_gta04-19254411db4e69d90958244c5017e7e4a38547b0.tar.bz2
regmap: Try cached read before checking if a hardware read is possible
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>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r--drivers/base/regmap/regmap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 3cf4785..b96cf72 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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;