diff mbox

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

Message ID f385d46e-cd60-ce57-d9c5-da23ad69e262@users.sourceforge.net (mailing list archive)
State New, archived
Headers show

Commit Message

SF Markus Elfring May 10, 2017, 3:15 p.m. UTC
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(-)

Comments

Noralf Trønnes May 10, 2017, 4:31 p.m. UTC | #1
Den 10.05.2017 17.15, skrev SF Markus Elfring:
> 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>
> ---

Thanks again,

Acked-by: Noralf Trønnes <noralf@tronnes.org>


>   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;
Dan Carpenter May 10, 2017, 7:26 p.m. UTC | #2
On Wed, May 10, 2017 at 05:15:33PM +0200, SF Markus Elfring wrote:
> 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/

This is not how to send v2 patches.

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

This is not a bug fix so do not use the fixes tag.

regards,
dan carpenter
diff mbox

Patch

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;