mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas KANDAGATLA <srinivas.kandagatla@st.com>
To: broonie@kernel.org
Cc: srinivas.kandagatla@st.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: [RFC] regmap: debugfs: Fix start_reg calculation
Date: Tue,  7 May 2013 14:11:37 +0100	[thread overview]
Message-ID: <1367932297-27926-1-git-send-email-srinivas.kandagatla@st.com> (raw)

From: Srinivas Kandagatla <srinivas.kandagatla@st.com>

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 <srinivas.kandagatla@st.com>
---
 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


             reply	other threads:[~2013-05-07 13:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07 13:11 Srinivas KANDAGATLA [this message]
2013-05-07 14:28 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367932297-27926-1-git-send-email-srinivas.kandagatla@st.com \
    --to=srinivas.kandagatla@st.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®