* [PATCH] mfd: pcf50633: use sprintf directly
@ 2014-09-04 9:32 Andy Shevchenko
2014-09-04 10:05 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2014-09-04 9:32 UTC (permalink / raw)
To: Lee Jones, linux-kernel; +Cc: Andy Shevchenko
When dump a content of the registers let's use snprintf() directly with %*ph
specifier.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/mfd/pcf50633-core.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index c87f7a0..8401552 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -106,10 +106,7 @@ static ssize_t show_dump_regs(struct device *dev, struct device_attribute *attr,
} else
dump[n1] = pcf50633_reg_read(pcf, n + n1);
- hex_dump_to_buffer(dump, sizeof(dump), 16, 1, buf1, 128, 0);
- buf1 += strlen(buf1);
- *buf1++ = '\n';
- *buf1 = '\0';
+ buf1 += sprintf(buf1, "%*ph\n", (int)sizeof(dump), dump);
}
return buf1 - buf;
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: pcf50633: use sprintf directly
2014-09-04 9:32 [PATCH] mfd: pcf50633: use sprintf directly Andy Shevchenko
@ 2014-09-04 10:05 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2014-09-04 10:05 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-kernel
On Thu, 04 Sep 2014, Andy Shevchenko wrote:
> When dump a content of the registers let's use snprintf() directly with %*ph
> specifier.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/mfd/pcf50633-core.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Applied, thanks.
> diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
> index c87f7a0..8401552 100644
> --- a/drivers/mfd/pcf50633-core.c
> +++ b/drivers/mfd/pcf50633-core.c
> @@ -106,10 +106,7 @@ static ssize_t show_dump_regs(struct device *dev, struct device_attribute *attr,
> } else
> dump[n1] = pcf50633_reg_read(pcf, n + n1);
>
> - hex_dump_to_buffer(dump, sizeof(dump), 16, 1, buf1, 128, 0);
> - buf1 += strlen(buf1);
> - *buf1++ = '\n';
> - *buf1 = '\0';
> + buf1 += sprintf(buf1, "%*ph\n", (int)sizeof(dump), dump);
> }
>
> return buf1 - buf;
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-04 10:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04 9:32 [PATCH] mfd: pcf50633: use sprintf directly Andy Shevchenko
2014-09-04 10:05 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox