linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] skd_main: use %*ph to dump small buffers
@ 2016-05-06 19:26 Andy Shevchenko
  2016-05-10 14:45 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2016-05-06 19:26 UTC (permalink / raw)
  To: Jens Axboe, Ming Lin, linux-kernel; +Cc: Andy Shevchenko

Replace custom approach by %*ph specifier to dump small buffers in hex format.

Unfortunately we can't use print_hex_dump_bytes() here since tha gap is
present, though one familiar with the code may change this.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/block/skd_main.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 910e065..2aa7fd4 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -2138,12 +2138,8 @@ static void skd_send_fitmsg(struct skd_device *skdev,
 		u8 *bp = (u8 *)skmsg->msg_buf;
 		int i;
 		for (i = 0; i < skmsg->length; i += 8) {
-			pr_debug("%s:%s:%d msg[%2d] %02x %02x %02x %02x "
-				 "%02x %02x %02x %02x\n",
-				 skdev->name, __func__, __LINE__,
-				 i, bp[i + 0], bp[i + 1], bp[i + 2],
-				 bp[i + 3], bp[i + 4], bp[i + 5],
-				 bp[i + 6], bp[i + 7]);
+			pr_debug("%s:%s:%d msg[%2d] %8ph\n",
+				 skdev->name, __func__, __LINE__, i, bp[i]);
 			if (i == 0)
 				i = 64 - 8;
 		}
@@ -2164,7 +2160,6 @@ static void skd_send_fitmsg(struct skd_device *skdev,
 		qcmd |= FIT_QCMD_MSGSIZE_64;
 
 	SKD_WRITEQ(skdev, qcmd, FIT_Q_COMMAND);
-
 }
 
 static void skd_send_special_fitmsg(struct skd_device *skdev,
@@ -2177,11 +2172,8 @@ static void skd_send_special_fitmsg(struct skd_device *skdev,
 		int i;
 
 		for (i = 0; i < SKD_N_SPECIAL_FITMSG_BYTES; i += 8) {
-			pr_debug("%s:%s:%d  spcl[%2d] %02x %02x %02x %02x  "
-				 "%02x %02x %02x %02x\n",
-				 skdev->name, __func__, __LINE__, i,
-				 bp[i + 0], bp[i + 1], bp[i + 2], bp[i + 3],
-				 bp[i + 4], bp[i + 5], bp[i + 6], bp[i + 7]);
+			pr_debug("%s:%s:%d  spcl[%2d] %8ph\n",
+				 skdev->name, __func__, __LINE__, i, bp[i]);
 			if (i == 0)
 				i = 64 - 8;
 		}
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] skd_main: use %*ph to dump small buffers
  2016-05-06 19:26 [PATCH v1 1/1] skd_main: use %*ph to dump small buffers Andy Shevchenko
@ 2016-05-10 14:45 ` Jens Axboe
  2016-05-10 15:00   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2016-05-10 14:45 UTC (permalink / raw)
  To: Andy Shevchenko, Ming Lin, linux-kernel

On 05/06/2016 01:26 PM, Andy Shevchenko wrote:
> Replace custom approach by %*ph specifier to dump small buffers in hex format.
>
> Unfortunately we can't use print_hex_dump_bytes() here since tha gap is
> present, though one familiar with the code may change this.

Did you test this?

   CC [M]  drivers/block/skd_main.o
In file included from include/linux/kernel.h:13:0,
                  from drivers/block/skd_main.c:19:
drivers/block/skd_main.c: In function ‘skd_send_fitmsg’:
include/linux/kern_levels.h:4:18: warning: format ‘%p’ expects argument
of type ‘void *’, but argument 6 has type ‘int’ [-Wformat=]
  #define KERN_SOH "\001"  /* ASCII Start Of Header */
                   ^
include/linux/printk.h:114:10: note: in definition of macro ‘no_printk’
    printk(fmt, ##__VA_ARGS__); \
           ^
include/linux/kern_levels.h:14:20: note: in expansion of macro
‘KERN_SOH’
  #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                     ^
include/linux/printk.h:289:12: note: in expansion of macro ‘KERN_DEBUG’
   no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
             ^
drivers/block/skd_main.c:2141:4: note: in expansion of macro ‘pr_debug’
     pr_debug("%s:%s:%d msg[%2d] %8ph\n",
     ^
drivers/block/skd_main.c: In function ‘skd_send_special_fitmsg’:
include/linux/kern_levels.h:4:18: warning: format ‘%p’ expects argument
of type ‘void *’, but argument 6 has type ‘int’ [-Wformat=]
  #define KERN_SOH "\001"  /* ASCII Start Of Header */
                   ^
include/linux/printk.h:114:10: note: in definition of macro ‘no_printk’
    printk(fmt, ##__VA_ARGS__); \
           ^
include/linux/kern_levels.h:14:20: note: in expansion of macro
‘KERN_SOH’
  #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
                     ^
include/linux/printk.h:289:12: note: in expansion of macro ‘KERN_DEBUG’
   no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
             ^
drivers/block/skd_main.c:2175:4: note: in expansion of macro ‘pr_debug’
     pr_debug("%s:%s:%d  spcl[%2d] %8ph\n",
     ^

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] skd_main: use %*ph to dump small buffers
  2016-05-10 14:45 ` Jens Axboe
@ 2016-05-10 15:00   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2016-05-10 15:00 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Andy Shevchenko, Ming Lin, linux-kernel

On Tue, May 10, 2016 at 5:45 PM, Jens Axboe <axboe@fb.com> wrote:
> On 05/06/2016 01:26 PM, Andy Shevchenko wrote:
>>
>> Replace custom approach by %*ph specifier to dump small buffers in hex
>> format.
>>
>> Unfortunately we can't use print_hex_dump_bytes() here since tha gap is
>> present, though one familiar with the code may change this.
>
>
> Did you test this?

Apparently I missed this somehow.

Typo is obvious, b[i] -> &b[i]

I will send an update and be sure that is compiled successfully.
Thanks!

>
>   CC [M]  drivers/block/skd_main.o
> In file included from include/linux/kernel.h:13:0,
>                  from drivers/block/skd_main.c:19:
> drivers/block/skd_main.c: In function ‘skd_send_fitmsg’:
> include/linux/kern_levels.h:4:18: warning: format ‘%p’ expects argument
> of type ‘void *’, but argument 6 has type ‘int’ [-Wformat=]
>  #define KERN_SOH "\001"  /* ASCII Start Of Header */
>                   ^
> include/linux/printk.h:114:10: note: in definition of macro ‘no_printk’
>    printk(fmt, ##__VA_ARGS__); \
>           ^
> include/linux/kern_levels.h:14:20: note: in expansion of macro
> ‘KERN_SOH’
>  #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
>                     ^
> include/linux/printk.h:289:12: note: in expansion of macro ‘KERN_DEBUG’
>   no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
>             ^
> drivers/block/skd_main.c:2141:4: note: in expansion of macro ‘pr_debug’
>     pr_debug("%s:%s:%d msg[%2d] %8ph\n",
>     ^
> drivers/block/skd_main.c: In function ‘skd_send_special_fitmsg’:
> include/linux/kern_levels.h:4:18: warning: format ‘%p’ expects argument
> of type ‘void *’, but argument 6 has type ‘int’ [-Wformat=]
>  #define KERN_SOH "\001"  /* ASCII Start Of Header */
>                   ^
> include/linux/printk.h:114:10: note: in definition of macro ‘no_printk’
>    printk(fmt, ##__VA_ARGS__); \
>           ^
> include/linux/kern_levels.h:14:20: note: in expansion of macro
> ‘KERN_SOH’
>  #define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
>                     ^
> include/linux/printk.h:289:12: note: in expansion of macro ‘KERN_DEBUG’
>   no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
>             ^
> drivers/block/skd_main.c:2175:4: note: in expansion of macro ‘pr_debug’
>     pr_debug("%s:%s:%d  spcl[%2d] %8ph\n",
>     ^
>
> --
> Jens Axboe



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-10 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-06 19:26 [PATCH v1 1/1] skd_main: use %*ph to dump small buffers Andy Shevchenko
2016-05-10 14:45 ` Jens Axboe
2016-05-10 15:00   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).