summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-09 13:23:31 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-10 10:24:03 +0100
commit6e6ace00a045251bd172b9b9c2379857bbff3dc7 (patch)
tree63a4d6686b3955ca16e7727883445209de67074b /drivers/base
parentf094fea68f0575286c55c06141cc89ffd0049024 (diff)
regmap: Return a sensible error code if we fail to read the cache
If a register isn't cached then let callers know that so they can fall back or error handle appropriately. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regcache-indexed.c7
-rw-r--r--drivers/base/regmap/regcache-lzo.c4
-rw-r--r--drivers/base/regmap/regcache-rbtree.c3
-rw-r--r--drivers/base/regmap/regcache.c2
4 files changed, 7 insertions, 9 deletions
diff --git a/drivers/base/regmap/regcache-indexed.c b/drivers/base/regmap/regcache-indexed.c
index 2e10bb13bfc4..507731ad8ec1 100644
--- a/drivers/base/regmap/regcache-indexed.c
+++ b/drivers/base/regmap/regcache-indexed.c
@@ -20,11 +20,10 @@ static int regcache_indexed_read(struct regmap *map, unsigned int reg,
int ret;
ret = regcache_lookup_reg(map, reg);
- if (ret < 0)
- *value = 0;
- else
+ if (ret >= 0)
*value = map->reg_defaults[ret].def;
- return 0;
+
+ return ret;
}
static int regcache_indexed_write(struct regmap *map, unsigned int reg,
diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c
index ad6af925f56c..066aeece3626 100644
--- a/drivers/base/regmap/regcache-lzo.c
+++ b/drivers/base/regmap/regcache-lzo.c
@@ -232,7 +232,6 @@ static int regcache_lzo_read(struct regmap *map,
size_t blksize, tmp_dst_len;
void *tmp_dst;
- *value = 0;
/* index of the compressed lzo block */
blkindex = regcache_lzo_get_blkindex(map, reg);
/* register index within the decompressed block */
@@ -261,7 +260,8 @@ static int regcache_lzo_read(struct regmap *map,
/* restore the pointer and length of the compressed block */
lzo_block->dst = tmp_dst;
lzo_block->dst_len = tmp_dst_len;
- return 0;
+
+ return ret;
}
static int regcache_lzo_write(struct regmap *map,
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 40f23dd8478c..887dbce63aff 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -193,8 +193,7 @@ static int regcache_rbtree_read(struct regmap *map,
*value = regcache_rbtree_get_register(rbnode, reg_tmp,
map->cache_word_size);
} else {
- /* uninitialized registers default to 0 */
- *value = 0;
+ return -ENOENT;
}
return 0;
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index c5379c86de88..409abd282c6c 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -378,7 +378,7 @@ int regcache_lookup_reg(struct regmap *map, unsigned int reg)
if (r)
return r - map->reg_defaults;
else
- return -1;
+ return -ENOENT;
}
int regcache_insert_reg(struct regmap *map, unsigned int reg,