regcache: Introduce the index parsing API by stride order
authorXiubo Li <lixiubo@cmss.chinamobile.com>
Mon, 4 Jan 2016 10:00:34 +0000 (18:00 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 19 Feb 2016 16:12:11 +0000 (01:12 +0900)
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 <lixiubo@cmss.chinamobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/internal.h

index c22b04b2ca1724b26df4440ad1003fbd7d15e796..5c79526245c2e3309a28766b781a9f2bccc850d5 100644 (file)
@@ -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