提交 cf57d607 编写于 作者: D Dimitris Papastamos 提交者: Mark Brown

regmap: debugfs: Optimize seeking within blocks of registers

Optimize this so that we can better guess where to start scanning
from.  We know the length of the register field format, therefore
given the file pointer position align to the nearest register
field and scan from there onwards.  We round down in this calculation
and we let the rest of the code figure out where to start scanning
from.
Signed-off-by: NDimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 c2c1ee66
...@@ -139,15 +139,17 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map, ...@@ -139,15 +139,17 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
WARN_ON(list_empty(&map->debugfs_off_cache)); WARN_ON(list_empty(&map->debugfs_off_cache));
ret = base; ret = base;
/* Find the relevant block */ /* Find the relevant block:offset */
list_for_each_entry(c, &map->debugfs_off_cache, list) { list_for_each_entry(c, &map->debugfs_off_cache, list) {
if (from >= c->min && from <= c->max) { if (from >= c->min && from <= c->max) {
*pos = c->min; fpos_offset = from - c->min;
return c->base_reg; reg_offset = fpos_offset / map->debugfs_tot_len;
*pos = c->min + (reg_offset * map->debugfs_tot_len);
return c->base_reg + reg_offset;
} }
*pos = c->min; *pos = c->max;
ret = c->base_reg; ret = c->max_reg;
} }
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册