]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
regmap: rbtree: When adding a reg do a bsearch for target node
authorNikesh Oswal <Nikesh.Oswal@wolfsonmicro.com>
Wed, 21 Oct 2015 13:16:14 +0000 (14:16 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 22 Oct 2015 13:02:45 +0000 (14:02 +0100)
commitc164cfba7c6569d01a83cb6fdde0cb1cadf72cf8
treec32d8c0a1d8e19a7f19cedc833ab8d56ee3abced
parent6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f
regmap: rbtree: When adding a reg do a bsearch for target node

A binary search is much more efficient rather than iterating
over the rbtree in ascending order which the current code is
doing.

During initialisation the reg defaults are written to the
cache in a large chunk and these are always sorted in the
ascending order so for this situation ideally we should have
iterated the rbtree in descending order.

But at runtime the drivers may write into the cache in any
random order so this patch selects to use a bsearch to give
an optimal runtime performance and also at initialisation
time when reg defaults are written the performance of binary
search would be much better than iterating in ascending order
which the current code was doing.

Signed-off-by: Nikesh Oswal <Nikesh.Oswal@wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regcache-rbtree.c