diff options
| author | Abhinav Kumar <abhinavk@codeaurora.org> | 2017-08-31 15:29:55 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-09-11 07:14:57 -0700 |
| commit | a1f29fd0b5e64e496fef33b329a9ea9b0e0b7471 (patch) | |
| tree | efa17cff2c09a943882586dddcfdc039e8d04587 /drivers/gpu | |
| parent | 1cbd1cdf8491634cca7f06812dbe8d1906033656 (diff) | |
drm/msm: fix non-zero offset register dumping
Remove format identifiers in the register dumping
function which incorrectly recognizes the offset and
the count of the registers to be dumped.
Also, reduce the chunk of memory copied from the SDE
hardware register range to align with the existing
register dumping mechanism.
Change-Id: I1ce7148275f5287e568fe6efc8774f4d495cdaa4
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/msm/sde_dbg.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/gpu/drm/msm/sde_dbg.c b/drivers/gpu/drm/msm/sde_dbg.c index b87bc75f17ea..5a0c5e677ed8 100644 --- a/drivers/gpu/drm/msm/sde_dbg.c +++ b/drivers/gpu/drm/msm/sde_dbg.c @@ -1765,7 +1765,7 @@ static ssize_t sde_dbg_reg_base_offset_write(struct file *file, buf[count] = 0; /* end of string */ - if (sscanf(buf, "%5x %x", &off, &cnt) != 2) + if (sscanf(buf, "%x %x", &off, &cnt) != 2) return -EFAULT; if (off > dbg->max_offset) @@ -1884,7 +1884,7 @@ static ssize_t sde_dbg_reg_base_reg_read(struct file *file, } if (!dbg->buf) { - char *hwbuf, *hwbuf_cur; + char *hwbuf; char dump_buf[64]; char __iomem *ioptr; int cnt, tot; @@ -1900,39 +1900,36 @@ static ssize_t sde_dbg_reg_base_reg_read(struct file *file, if (!dbg->buf) return -ENOMEM; - hwbuf = kzalloc(dbg->buf_len, GFP_KERNEL); + hwbuf = kzalloc(ROW_BYTES, GFP_KERNEL); if (!hwbuf) { kfree(dbg->buf); return -ENOMEM; } - hwbuf_cur = hwbuf; ioptr = dbg->base + dbg->off; tot = 0; - _sde_dbg_enable_power(true); - memcpy_fromio(hwbuf, ioptr, dbg->buf_len); - - _sde_dbg_enable_power(false); - for (cnt = dbg->cnt; cnt > 0; cnt -= ROW_BYTES) { - hex_dump_to_buffer(hwbuf_cur, + memcpy_fromio(hwbuf, ioptr, ROW_BYTES); + hex_dump_to_buffer(hwbuf, min(cnt, ROW_BYTES), ROW_BYTES, GROUP_BYTES, dump_buf, sizeof(dump_buf), false); len = scnprintf(dbg->buf + tot, dbg->buf_len - tot, "0x%08x: %s\n", - ((int) (unsigned long) hwbuf_cur) - + ((int) (unsigned long) ioptr) - ((int) (unsigned long) dbg->base), dump_buf); - hwbuf_cur += ROW_BYTES; + ioptr += ROW_BYTES; tot += len; if (tot >= dbg->buf_len) break; } + _sde_dbg_enable_power(false); + dbg->buf_len = tot; kfree(hwbuf); } |
