From: Andy Shevchenko Date: Thu, 5 Mar 2026 08:53:00 +0000 (+0100) Subject: regcache: Move count check and cache_bypass assignment to the caller X-Git-Tag: v7.1-rc1~155^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e2d279724944f788edc633e4888107eae666a37;p=thirdparty%2Flinux.git 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 Link: https://patch.msgid.link/20260305085449.3184020-2-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 329cdee1ae1c4..b73de70bbf3f7 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;