diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2013-02-08 07:47:14 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-11 06:25:32 -0500 |
commit | c2c1ee66016a45477f58f0fd30907b1e959ca76b (patch) | |
tree | 77572b80e8012493804fdbcbd8c5f26186de2c9e /drivers/base | |
parent | f3eb83994cb4c172ce5028b5ae7ea08462cc3f1d (diff) |
regmap: debugfs: Add a `max_reg' member in struct regmap_debugfs_off_cache
We are keeping track of the maximum register as well, this will make
things easier for us in sharing this code with the code implementing
the register ranges functionality. It also simplifies a bit the
calculations when looking for the relevant block:offset from within
the cache.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/regmap/internal.h | 1 | ||||
-rw-r--r-- | drivers/base/regmap/regmap-debugfs.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index 401d1919635a..26b8ffde1458 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h | |||
@@ -25,6 +25,7 @@ struct regmap_debugfs_off_cache { | |||
25 | off_t min; | 25 | off_t min; |
26 | off_t max; | 26 | off_t max; |
27 | unsigned int base_reg; | 27 | unsigned int base_reg; |
28 | unsigned int max_reg; | ||
28 | }; | 29 | }; |
29 | 30 | ||
30 | struct regmap_format { | 31 | struct regmap_format { |
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 0e94fd3c95a3..3fade1ceaf15 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -81,6 +81,8 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map, | |||
81 | struct regmap_debugfs_off_cache *c = NULL; | 81 | struct regmap_debugfs_off_cache *c = NULL; |
82 | loff_t p = 0; | 82 | loff_t p = 0; |
83 | unsigned int i, ret; | 83 | unsigned int i, ret; |
84 | unsigned int fpos_offset; | ||
85 | unsigned int reg_offset; | ||
84 | 86 | ||
85 | /* | 87 | /* |
86 | * If we don't have a cache build one so we don't have to do a | 88 | * If we don't have a cache build one so we don't have to do a |
@@ -93,6 +95,9 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map, | |||
93 | regmap_precious(map, i)) { | 95 | regmap_precious(map, i)) { |
94 | if (c) { | 96 | if (c) { |
95 | c->max = p - 1; | 97 | c->max = p - 1; |
98 | fpos_offset = c->max - c->min; | ||
99 | reg_offset = fpos_offset / map->debugfs_tot_len; | ||
100 | c->max_reg = c->base_reg + reg_offset; | ||
96 | list_add_tail(&c->list, | 101 | list_add_tail(&c->list, |
97 | &map->debugfs_off_cache); | 102 | &map->debugfs_off_cache); |
98 | c = NULL; | 103 | c = NULL; |
@@ -119,6 +124,9 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map, | |||
119 | /* Close the last entry off if we didn't scan beyond it */ | 124 | /* Close the last entry off if we didn't scan beyond it */ |
120 | if (c) { | 125 | if (c) { |
121 | c->max = p - 1; | 126 | c->max = p - 1; |
127 | fpos_offset = c->max - c->min; | ||
128 | reg_offset = fpos_offset / map->debugfs_tot_len; | ||
129 | c->max_reg = c->base_reg + reg_offset; | ||
122 | list_add_tail(&c->list, | 130 | list_add_tail(&c->list, |
123 | &map->debugfs_off_cache); | 131 | &map->debugfs_off_cache); |
124 | } | 132 | } |