regmap: Load register defaults in blocks rather than register by register
authorMark Brown <broonie@kernel.org>
Tue, 23 May 2023 21:22:27 +0000 (22:22 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 24 May 2023 10:21:56 +0000 (11:21 +0100)
commit3a48d2127f4dbd767d43bf8280b67d585e701f75
tree03c2d1f4effc308aafb02c22476bcd7801ff4d1a
parent90d0d6009c0f6b0693ac58096c655a2df61e0d50
regmap: Load register defaults in blocks rather than register by register

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>
drivers/base/regmap/regcache-maple.c