From: Xiubo Li Date: Mon, 4 Jan 2016 10:00:34 +0000 (+0800) Subject: regcache: Introduce the index parsing API by stride order X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8b31ec5572f812acac36f3d02944ade76a8f51b9;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git regcache: Introduce the index parsing API by stride order Here introduces regcache_get_index_by_order() for regmap cache, which uses the register stride order and bit rotation, to improve the performance. Signed-off-by: Xiubo Li Signed-off-by: Mark Brown --- diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index c22b04b2ca17..5c79526245c2 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h @@ -273,4 +273,10 @@ static inline unsigned int regmap_get_offset(const struct regmap *map, return index * map->reg_stride; } +static inline unsigned int regcache_get_index_by_order(const struct regmap *map, + unsigned int reg) +{ + return reg >> map->reg_stride_order; +} + #endif