aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2013-02-08 07:47:20 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-02-11 06:25:33 -0500
commitcf57d6071f0610c99856c006ac06eb98a151f485 (patch)
tree18a88144112ef72369b89b0c0b4b991eea593102
parentc2c1ee66016a45477f58f0fd30907b1e959ca76b (diff)
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>
-rw-r--r--drivers/base/regmap/regmap-debugfs.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 3fade1ceaf15..246f459e9170 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,
139 WARN_ON(list_empty(&map->debugfs_off_cache)); 139 WARN_ON(list_empty(&map->debugfs_off_cache));
140 ret = base; 140 ret = base;
141 141
142 /* Find the relevant block */ 142 /* Find the relevant block:offset */
143 list_for_each_entry(c, &map->debugfs_off_cache, list) { 143 list_for_each_entry(c, &map->debugfs_off_cache, list) {
144 if (from >= c->min && from <= c->max) { 144 if (from >= c->min && from <= c->max) {
145 *pos = c->min; 145 fpos_offset = from - c->min;
146 return c->base_reg; 146 reg_offset = fpos_offset / map->debugfs_tot_len;
147 *pos = c->min + (reg_offset * map->debugfs_tot_len);
148 return c->base_reg + reg_offset;
147 } 149 }
148 150
149 *pos = c->min; 151 *pos = c->max;
150 ret = c->base_reg; 152 ret = c->max_reg;
151 } 153 }
152 154
153 return ret; 155 return ret;