summaryrefslogtreecommitdiff
path: root/drivers/base/regmap/regcache-rbtree.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2011-09-27 20:15:37 +0200
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-09-28 13:18:11 +0100
commitc5713004b304e89c8c5117d8f226d5a1603571dc (patch)
treedc33145c0b995e3f55cdc88565438c22b1bcbeec /drivers/base/regmap/regcache-rbtree.c
parent954757d767a78bc4b863fa9ea703bd7f814c8a55 (diff)
regmap: regcache_rbtree_{set,get}_register: Use regcache_{set,get}_val
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> Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regcache-rbtree.c')
-rw-r--r--drivers/base/regmap/regcache-rbtree.c35
1 files changed, 2 insertions, 33 deletions
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index dd1b937a0d84..52669dec73b3 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(