regmap: regcache_rbtree_{set,get}_register: Use regcache_{set,get}_val
authorLars-Peter Clausen <lars@metafoo.de>
Tue, 27 Sep 2011 18:15:37 +0000 (20:15 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 28 Sep 2011 12:18:11 +0000 (13:18 +0100)
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>
drivers/base/regmap/regcache-rbtree.c

index dd1b937a0d849e891e3f5f41cb764d446e34db7b..52669dec73b3ce0b7c49b10f28eea59ef6f14a0d 100644 (file)
@@ -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(