• Nikesh Oswal's avatar
    regmap: rbtree: When adding a reg do a bsearch for target node · 6399aea6
    Nikesh Oswal authored
    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: default avatarNikesh Oswal <Nikesh.Oswal@wolfsonmicro.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    6399aea6
regcache-rbtree.c 13.5 KB