]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
regcache: Move count check and cache_bypass assignment to the caller
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 5 Mar 2026 08:53:00 +0000 (09:53 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 5 Mar 2026 15:22:59 +0000 (15:22 +0000)
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>
drivers/base/regmap/regcache.c

index 329cdee1ae1c403d72ba924617be158072c83923..b73de70bbf3f78910f27cb9eddc0e0d62d488d48 100644 (file)
@@ -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;