aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-02-21 18:07:01 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-04 10:30:27 +0800
commit325acab447f775bc2258b3a37a780893c203ab6c (patch)
tree8d9c3b4f40fd5329f1992284f39ab5117d8151ab
parent879082c9fe6e8fbddf787170eee605e4be138d0f (diff)
downloadkernel_goldelico_gta04-325acab447f775bc2258b3a37a780893c203ab6c.zip
kernel_goldelico_gta04-325acab447f775bc2258b3a37a780893c203ab6c.tar.gz
kernel_goldelico_gta04-325acab447f775bc2258b3a37a780893c203ab6c.tar.bz2
regmap: cache: Use regcache_get_value() to check if we updated
Factor things out a little. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--drivers/base/regmap/regcache.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index f0a3db6..6948996 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -418,25 +418,22 @@ EXPORT_SYMBOL_GPL(regcache_cache_bypass);
bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
unsigned int val)
{
+ if (regcache_get_val(map, base, idx) == val)
+ return true;
+
switch (map->cache_word_size) {
case 1: {
u8 *cache = base;
- if (cache[idx] == val)
- return true;
cache[idx] = val;
break;
}
case 2: {
u16 *cache = base;
- if (cache[idx] == val)
- return true;
cache[idx] = val;
break;
}
case 4: {
u32 *cache = base;
- if (cache[idx] == val)
- return true;
cache[idx] = val;
break;
}