mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
879082c9fe
commit
325acab447
|
@ -418,25 +418,22 @@ EXPORT_SYMBOL_GPL(regcache_cache_bypass);
|
||||||
bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
|
bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
|
||||||
unsigned int val)
|
unsigned int val)
|
||||||
{
|
{
|
||||||
|
if (regcache_get_val(map, base, idx) == val)
|
||||||
|
return true;
|
||||||
|
|
||||||
switch (map->cache_word_size) {
|
switch (map->cache_word_size) {
|
||||||
case 1: {
|
case 1: {
|
||||||
u8 *cache = base;
|
u8 *cache = base;
|
||||||
if (cache[idx] == val)
|
|
||||||
return true;
|
|
||||||
cache[idx] = val;
|
cache[idx] = val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
u16 *cache = base;
|
u16 *cache = base;
|
||||||
if (cache[idx] == val)
|
|
||||||
return true;
|
|
||||||
cache[idx] = val;
|
cache[idx] = val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
u32 *cache = base;
|
u32 *cache = base;
|
||||||
if (cache[idx] == val)
|
|
||||||
return true;
|
|
||||||
cache[idx] = val;
|
cache[idx] = val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue