regmap: Load register defaults in blocks rather than register by register

[ Upstream commit 3a48d2127f ]

Currently we use the normal single register write function to load the
default values into the cache, resulting in a large number of reallocations
when there are blocks of registers as we extend the memory region we are
using to store the values. Instead scan through the list of defaults for
blocks of adjacent registers and do a single allocation and insert for each
such block. No functional change.

We do not take advantage of the maple tree preallocation, this is purely at
the regcache level. It is not clear to me yet if the maple tree level would
help much here or if we'd have more overhead from overallocating and then
freeing maple tree data.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230523-regcache-maple-load-defaults-v1-1-0c04336f005d@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: b0393e1fe4 ("regmap: maple: Use alloc_flags for memory allocations")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Mark Brown 2023-05-23 22:22:27 +01:00 • committed by Greg Kroah-Hartman
commit b60dbf791b