Make regcache_count_cacheable_registers() just a counting routine
without any side effects by moving count check and cache_bypass
assignment to the caller.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/base/regmap/regcache.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 329cdee1ae1c..b73de70bbf3f 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -53,10 +53,6 @@ static int regcache_count_cacheable_registers(struct regmap *map)
!regmap_volatile(map, i * map->reg_stride))
count++;
- /* all registers are unreadable or volatile, so just bypass */
- if (!count)
- map->cache_bypass = true;
-
return count;
}
@@ -206,6 +202,10 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
map->reg_defaults = tmp_buf;
} else if (map->num_reg_defaults_raw) {
count = regcache_count_cacheable_registers(map);
+ if (!count)
+ map->cache_bypass = true;
+
+ /* All registers are unreadable or volatile, so just bypass */
if (map->cache_bypass)
return 0;
--
2.50.1