]> git.ipfire.org Git - thirdparty/linux.git/commit
regmap: add flat cache with sparse validity
authorSander Vanheule <sander@svanheule.net>
Wed, 29 Oct 2025 08:12:47 +0000 (09:12 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 29 Oct 2025 12:54:04 +0000 (12:54 +0000)
commit9c7f7262bc1affb9b9acd2ec2fb1f6314d5d474c
tree966568ad1978d9e4945af06b6d372aa90c30c508
parentdcb6fa37fd7bc9c3d2b066329b0d27dedf8becaa
regmap: add flat cache with sparse validity

The flat regcache will always assume the data in the cache is valid.
Since the cache is preferred over hardware access, this may shadow the
actual state of the device.

Add a new containing cache structure with the flat data table and a
bitmap indicating cache validity. REGCACHE_FLAT will still behave as
before, as the validity is ignored.

Define new cache type REGCACHE_FLAT_S: a flat cache with sparse
validity. The sparse validity is used to determine if a hardware access
should occur to initialize the cache on the fly, vs. at regmap init for
REGCACHE_FLAT. Contrary to REGCACHE_FLAT, this allows us to implement
regcache_ops.drop.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Link: https://patch.msgid.link/20251029081248.52607-2-sander@svanheule.net
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/internal.h
drivers/base/regmap/regcache-flat.c
drivers/base/regmap/regcache.c
drivers/base/regmap/regmap-kunit.c
include/linux/regmap.h