* [PATCH] media/pci/cobalt: Use %*ph to print small buffers
@ 2015-08-26 18:51 Alexander Kuleshov
2015-08-26 18:56 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kuleshov @ 2015-08-26 18:51 UTC (permalink / raw)
To: Hans Verkuil, Mauro Carvalho Chehab
Cc: linux-media, linux-kernel, Alexander Kuleshov
printk() supports %*ph format specifier for printing a small buffers,
let's use it intead of %02x %02x...
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
drivers/media/pci/cobalt/cobalt-cpld.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/media/pci/cobalt/cobalt-cpld.c b/drivers/media/pci/cobalt/cobalt-cpld.c
index e83f5c9..e406eab 100644
--- a/drivers/media/pci/cobalt/cobalt-cpld.c
+++ b/drivers/media/pci/cobalt/cobalt-cpld.c
@@ -290,8 +290,8 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
0x01, 0xc7, 0xfc, 0x7f, 0x53, 0x62).
*/
- cobalt_dbg(1, "%u: %02x %02x %02x %02x %02x %02x\n", f_out,
- regs[0], regs[1], regs[2], regs[3], regs[4], regs[5]);
+ cobalt_dbg(1, "%u: %6ph\n", f_out, regs);
+
while (retries--) {
u8 read_regs[6];
@@ -330,9 +330,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
if (!memcmp(read_regs, regs, sizeof(read_regs)))
break;
- cobalt_dbg(1, "retry: %02x %02x %02x %02x %02x %02x\n",
- read_regs[0], read_regs[1], read_regs[2],
- read_regs[3], read_regs[4], read_regs[5]);
+ cobalt_dbg(1, "retry: %6ph\n");
}
if (2 - retries)
cobalt_info("Needed %d retries\n", 2 - retries);
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media/pci/cobalt: Use %*ph to print small buffers
2015-08-26 18:51 [PATCH] media/pci/cobalt: Use %*ph to print small buffers Alexander Kuleshov
@ 2015-08-26 18:56 ` Joe Perches
2015-08-26 19:07 ` Alexander Kuleshov
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2015-08-26 18:56 UTC (permalink / raw)
To: Alexander Kuleshov
Cc: Hans Verkuil, Mauro Carvalho Chehab, linux-media, linux-kernel
On Thu, 2015-08-27 at 00:51 +0600, Alexander Kuleshov wrote:
> printk() supports %*ph format specifier for printing a small buffers,
> let's use it intead of %02x %02x...
Having just suffered this myself...
> diff --git a/drivers/media/pci/cobalt/cobalt-cpld.c b/drivers/media/pci/cobalt/cobalt-cpld.c
[]
> @@ -330,9 +330,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
>
> if (!memcmp(read_regs, regs, sizeof(read_regs)))
> break;
> - cobalt_dbg(1, "retry: %02x %02x %02x %02x %02x %02x\n",
> - read_regs[0], read_regs[1], read_regs[2],
> - read_regs[3], read_regs[4], read_regs[5]);
> + cobalt_dbg(1, "retry: %6ph\n");
Aren't you missing something like compile testing?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media/pci/cobalt: Use %*ph to print small buffers
2015-08-26 18:56 ` Joe Perches
@ 2015-08-26 19:07 ` Alexander Kuleshov
0 siblings, 0 replies; 3+ messages in thread
From: Alexander Kuleshov @ 2015-08-26 19:07 UTC (permalink / raw)
To: Joe Perches; +Cc: Hans Verkuil, Mauro Carvalho Chehab, linux-media, LKML
Oh, nope, resent
2015-08-27 0:56 GMT+06:00 Joe Perches <joe@perches.com>:
> On Thu, 2015-08-27 at 00:51 +0600, Alexander Kuleshov wrote:
>> printk() supports %*ph format specifier for printing a small buffers,
>> let's use it intead of %02x %02x...
>
> Having just suffered this myself...
>
>> diff --git a/drivers/media/pci/cobalt/cobalt-cpld.c b/drivers/media/pci/cobalt/cobalt-cpld.c
> []
>> @@ -330,9 +330,7 @@ bool cobalt_cpld_set_freq(struct cobalt *cobalt, unsigned f_out)
>>
>> if (!memcmp(read_regs, regs, sizeof(read_regs)))
>> break;
>> - cobalt_dbg(1, "retry: %02x %02x %02x %02x %02x %02x\n",
>> - read_regs[0], read_regs[1], read_regs[2],
>> - read_regs[3], read_regs[4], read_regs[5]);
>> + cobalt_dbg(1, "retry: %6ph\n");
>
> Aren't you missing something like compile testing?
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-26 19:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-26 18:51 [PATCH] media/pci/cobalt: Use %*ph to print small buffers Alexander Kuleshov
2015-08-26 18:56 ` Joe Perches
2015-08-26 19:07 ` Alexander Kuleshov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.