diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2013-02-08 12:47:20 +0000 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-11 11:25:33 +0000 |
commit | cf57d6071f0610c99856c006ac06eb98a151f485 (patch) | |
tree | 18a88144112ef72369b89b0c0b4b991eea593102 /drivers | |
parent | c2c1ee66016a45477f58f0fd30907b1e959ca76b (diff) | |
download | op-kernel-dev-cf57d6071f0610c99856c006ac06eb98a151f485.zip op-kernel-dev-cf57d6071f0610c99856c006ac06eb98a151f485.tar.gz |
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: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/regmap/regmap-debugfs.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 3fade1c..246f459 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -139,15 +139,17 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map, WARN_ON(list_empty(&map->debugfs_off_cache)); ret = base; - /* Find the relevant block */ + /* Find the relevant block:offset */ list_for_each_entry(c, &map->debugfs_off_cache, list) { if (from >= c->min && from <= c->max) { - *pos = c->min; - return c->base_reg; + fpos_offset = from - c->min; + 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; - ret = c->base_reg; + *pos = c->max; + ret = c->max_reg; } return ret; |