Unverified Commit 8e2d2797 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown
Browse files

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260305085449.3184020-2-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9891b52b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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;