summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2011-11-16 16:28:19 +0100
committerLokesh Pathak <lpathak@nvidia.com>2012-03-05 07:52:01 -0800
commit48776167823fee3cdff743fc03873e74c507704f (patch)
tree216c2dd608f42f22141653451f22fee9ab8fdad1
parente072692e9e2bc35439b34e3c070d5a56b0b5d43c (diff)
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> (cherry picked from commit 19254411db4e69d90958244c5017e7e4a38547b0) Change-Id: Ibdcf86abfca530dfe40a425b1b172ab6b8114408 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/87561
-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 8f6c226e9985..400f9691ef8f 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;