From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: dp@opensource.wolfsonmicro.com
Cc: linux-kernel@vger.kernel.org,
patches@opensource.wolfsonmicro.com,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 1/2] regmap: Return a sensible error code if we fail to read the cache
Date: Sun, 9 Oct 2011 14:44:35 +0100 [thread overview]
Message-ID: <1318167876-17801-1-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
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>
---
drivers/base/regmap/regcache-indexed.c | 7 +++----
drivers/base/regmap/regcache-lzo.c | 4 ++--
drivers/base/regmap/regcache-rbtree.c | 3 +--
drivers/base/regmap/regcache.c | 2 +-
4 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/base/regmap/regcache-indexed.c b/drivers/base/regmap/regcache-indexed.c
index 2e10bb1..507731a 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 ad6af92..066aeec 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 f80eebc..e314984 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 bf82783..67c7703 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -379,7 +379,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,
--
1.7.6.3
next reply other threads:[~2011-10-09 13:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-09 13:44 Mark Brown [this message]
2011-10-09 13:44 ` [PATCH 2/2] regmap: Allow caches for devices with no defaults Mark Brown
2011-10-09 17:43 ` Valdis.Kletnieks
2011-10-09 19:34 ` Mark Brown
2011-10-10 8:41 ` Dimitris Papastamos
2011-10-10 9:23 ` Mark Brown
2011-10-10 10:50 ` Dimitris Papastamos
2011-10-10 9:03 ` [PATCH 1/2] regmap: Return a sensible error code if we fail to read the cache Dimitris Papastamos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318167876-17801-1-git-send-email-broonie@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=dp@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.wolfsonmicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®