From: Srinivas Kandagatla <[email protected]>
If we dump syscon regmap registers via debufs you will notice that the
dump contains lot of XXXXXXXX values at the end.
An example configuration is:
syscon@fdde0000{
compatible = "syscon";
reg = <0xfdde0000 0x15c>;
};
example dump:
cat /sys/kernel/debug/regmap/fdde0000.syscon/registers
...
154: 001c1dff
158: 00000003
05a: XXXXXXXX
05e: XXXXXXXX
...
regmap_debugfs_get_dump_start returns register number, not the actual
offset into the map. So we use the return value as start to dump the
registers we can endup with wrong start address, in the example case
for the second loop the code ends up with start_reg = 0x56. Which is
incorrect.
Also this keeps incremeting by stride, which can than result in
unaligned address.
This patch multiples the return value of regmap_debugfs_get_dump_start
with stride to get the correct offset into the map.
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/base/regmap/regmap-debugfs.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 81d6f60..4a66e54 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -190,6 +190,7 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
/* Work out which register we're starting at */
start_reg = regmap_debugfs_get_dump_start(map, from, *ppos, &p);
+ start_reg *= map->reg_stride;
for (i = start_reg; i <= to; i += map->reg_stride) {
if (!regmap_readable(map, i))
--
1.7.6.5
On Tue, May 07, 2013 at 02:11:37PM +0100, Srinivas KANDAGATLA wrote:
> regmap_debugfs_get_dump_start returns register number, not the actual
> offset into the map. So we use the return value as start to dump the
No, it doesn't - it returns the register it should start reading from.
It's just that the code isn't paying attention to stride and should.
Fix the function, not the callers.