lkml.org 
[lkml]   [2017]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] tinydrm: mipi-dbi: Adjust buffer output in mipi_dbi_debugfs_command_show()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 May 2017 17:03:20 +0200

* Use a special format string specification for the desired output of the
array "val" into a sequence.

* Adjust two local variables accordingly.

This refactoring supersedes the update suggestion "tinydrm: mipi-dbi:
Use seq_putc() in mipi_dbi_debugfs_command_show()" from 2017-05-08.
https://patchwork.kernel.org/patch/9716119/

Fixes: 02dd95fe316936269a52d6ccb971bb956412b40a ("drm/tinydrm: Add MIPI DBI support")

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/gpu/drm/tinydrm/mipi-dbi.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c
index f4eb412f3604..2670259d1798 100644
--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -914,8 +914,7 @@ static int mipi_dbi_debugfs_command_show(struct seq_file *m, void *unused)
{
struct mipi_dbi *mipi = m->private;
u8 cmd, val[4];
- size_t len, i;
- int ret;
+ int len, ret;

for (cmd = 0; cmd < 255; cmd++) {
if (!mipi_dbi_command_is_read(mipi, cmd))
@@ -944,9 +943,7 @@ static int mipi_dbi_debugfs_command_show(struct seq_file *m, void *unused)
continue;
}

- for (i = 0; i < len; i++)
- seq_printf(m, "%02x", val[i]);
- seq_puts(m, "\n");
+ seq_printf(m, "%*phN\n", len, val);
}

return 0;
--
2.12.3
\
 
 \ /
  Last update: 2017-05-10 21:22    [W:1.939 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site