[PATCH] tinydrm: mipi-dbi: Adjust buffer output in mipi_dbi_debugfs_command_show()

SF Markus Elfring elfring at users.sourceforge.net
Wed May 10 15:15:33 UTC 2017


From: Markus Elfring <elfring at 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 at perches.com>
Signed-off-by: Markus Elfring <elfring at 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



More information about the dri-devel mailing list