regmap: rbtree: Make cache_present bitmap per node
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 29 Aug 2013 08:26:34 +0000 (10:26 +0200)
committerMark Brown <broonie@linaro.org>
Thu, 29 Aug 2013 12:32:41 +0000 (13:32 +0100)
commit3f4ff561bc88b074d5e868dde4012d89cbb06c87
treee611b5128911d15253f558ff2a137a26dd7ad695
parent472fdec7380cec483e241fa696d9b90bc37ddd4c
regmap: rbtree: Make cache_present bitmap per node

With devices which have a dense and small register map but placed at a large
offset the global cache_present bitmap imposes a huge memory overhead. Making
the cache_present per rbtree node avoids the issue and easily reduces the memory
footprint by a factor of ten. For devices with a more sparse map or without a
large base register offset the memory usage might increase slightly by a few
bytes, but not significantly. E.g. for a device which has ~50 registers at
offset 0x4000 the memory footprint of the register cache goes down form 2496
bytes to 175 bytes.

Moving the bitmap to a per node basis means that the handling of the bitmap is
now cache implementation specific and can no longer be managed by the core. The
regcache_sync_block() function is extended by a additional parameter so that the
cache implementation can tell the core which registers in the block are set and
which are not. The parameter is optional and if NULL the core assumes that all
registers are set. The rbtree cache also needs to implement its own drop
callback instead of relying on the core to handle this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/base/regmap/internal.h
drivers/base/regmap/regcache-rbtree.c
drivers/base/regmap/regcache.c
This page took 0.025803 seconds and 5 git commands to generate.