Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1214135 > unrolled thread

[PATCH] media/pci/cobalt: Use %*ph to print small buffers

Started byAlexander Kuleshov <kuleshovmail@gmail.com>
First post2015-08-26 21:00 +0200
Last post2015-08-26 21:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] media/pci/cobalt: Use %*ph to print small buffers Alexander Kuleshov <kuleshovmail@gmail.com> - 2015-08-26 21:00 +0200
    Re: [PATCH] media/pci/cobalt: Use %*ph to print small buffers Joe Perches <joe@perches.com> - 2015-08-26 21:00 +0200
      Re: [PATCH] media/pci/cobalt: Use %*ph to print small buffers Alexander Kuleshov <kuleshovmail@gmail.com> - 2015-08-26 21:10 +0200

#1214135 — [PATCH] media/pci/cobalt: Use %*ph to print small buffers

FromAlexander Kuleshov <kuleshovmail@gmail.com>
Date2015-08-26 21:00 +0200
Subject[PATCH] media/pci/cobalt: Use %*ph to print small buffers
Message-ID<q1O5s-5Pg-21@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1214137

FromJoe Perches <joe@perches.com>
Date2015-08-26 21:00 +0200
Message-ID<q1O5s-5Pg-31@gated-at.bofh.it>
In reply to#1214135
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?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1214140

FromAlexander Kuleshov <kuleshovmail@gmail.com>
Date2015-08-26 21:10 +0200
Message-ID<q1Of8-6fF-7@gated-at.bofh.it>
In reply to#1214137
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?
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web