From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>,
linux-kernel@vger.kernel.org,
Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 1/2] regmap: regcache_rbtree_{set,get}_register: Use regcache_{set,get}_val
Date: Tue, 27 Sep 2011 20:15:37 +0200 [thread overview]
Message-ID: <1317147338-21492-1-git-send-email-lars@metafoo.de> (raw)
Use regcache_{set,get}_val in regcache_rbtree_{set,get}_register instead of
re-implementing its functionality.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
drivers/base/regmap/regcache-rbtree.c | 35 +-------------------------------
1 files changed, 2 insertions(+), 33 deletions(-)
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index dd1b937..52669de 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -46,45 +46,14 @@ static unsigned int regcache_rbtree_get_register(
struct regcache_rbtree_node *rbnode, unsigned int idx,
unsigned int word_size)
{
- unsigned int val;
-
- switch (word_size) {
- case 1: {
- u8 *p = rbnode->block;
- val = p[idx];
- return val;
- }
- case 2: {
- u16 *p = rbnode->block;
- val = p[idx];
- return val;
- }
- default:
- BUG();
- break;
- }
- return -1;
+ return regcache_get_val(rbnode->block, idx, word_size);
}
static void regcache_rbtree_set_register(struct regcache_rbtree_node *rbnode,
unsigned int idx, unsigned int val,
unsigned int word_size)
{
- switch (word_size) {
- case 1: {
- u8 *p = rbnode->block;
- p[idx] = val;
- break;
- }
- case 2: {
- u16 *p = rbnode->block;
- p[idx] = val;
- break;
- }
- default:
- BUG();
- break;
- }
+ regcache_set_val(rbnode->block, idx, val, word_size);
}
static struct regcache_rbtree_node *regcache_rbtree_lookup(
--
1.7.2.5
next reply other threads:[~2011-09-27 18:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-27 18:15 Lars-Peter Clausen [this message]
2011-09-27 18:15 ` [PATCH 2/2] regmap: rbtree-cache: Move cached rbnode handling into lookup function Lars-Peter Clausen
2011-09-28 10:09 ` Dimitris Papastamos
2011-09-28 12:18 ` [PATCH 1/2] regmap: regcache_rbtree_{set,get}_register: Use regcache_{set,get}_val Mark Brown
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=1317147338-21492-1-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dp@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
/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®