Skip to content

Commit 8e2d279

Browse files
andy-shevbroonie
authored andcommitted
regcache: Move count check and cache_bypass assignment to the caller
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> Link: https://patch.msgid.link/20260305085449.3184020-2-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 9891b52 commit 8e2d279

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/base/regmap/regcache.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ static int regcache_count_cacheable_registers(struct regmap *map)
5353
!regmap_volatile(map, i * map->reg_stride))
5454
count++;
5555

56-
/* all registers are unreadable or volatile, so just bypass */
57-
if (!count)
58-
map->cache_bypass = true;
59-
6056
return count;
6157
}
6258

@@ -206,6 +202,10 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
206202
map->reg_defaults = tmp_buf;
207203
} else if (map->num_reg_defaults_raw) {
208204
count = regcache_count_cacheable_registers(map);
205+
if (!count)
206+
map->cache_bypass = true;
207+
208+
/* All registers are unreadable or volatile, so just bypass */
209209
if (map->cache_bypass)
210210
return 0;
211211

0 commit comments

Comments
 (0)