浏览代码

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 <lixiubo@cmss.chinamobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Xiubo Li 9 年之前
父节点
当前提交
8b31ec5572
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      drivers/base/regmap/internal.h

+ 6 - 0
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