irda: vlsi_ir: use %*ph specifier
Subsystems (2)
PATCH v2 1/1 irda: vlsi_ir: use %*ph specifier
Instead of looping in the code let's use kernel extension to dump small buffers.
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/net/irda/vlsi_ir.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/irda/vlsi_ir.c +2 -8
@@ -323,14 +323,8 @@ static void vlsi_proc_ring(struct seq_file *seq, struct vlsi_ring *r) j = (unsigned )rd_get_count (rd);seq_printf (seq,"current: rd = %d / status = %02x / len = %u\n" , h, (unsigned )rd_get_status (rd), j); -if (j >0 ) { -seq_printf (seq," data:" ); -if (j >20 ) - j =20 ; -for (i =0 ; i < j; i++) -seq_printf (seq," %02x" , (unsigned )((unsigned char *)rd->buf)[i]); -seq_printf (seq,"\n" ); - } +if (j >0 ) +seq_printf (seq," data: %*ph\n" ,min (j,20 ), rd->buf); }for (i =0 ; i < r->size; i++) { rd = &r->rd[i];
Signature · 1 line
2.1.0
David Miller
maintainerFrom: Andy Shevchenko <[email protected]>
Date: Mon, 8 Sep 2014 10:38:43 +0300
Quoted 4 lines
Instead of looping in the code let's use kernel extension to dump small buffers.
Signed-off-by Andy Shevchenko <[email protected]>
Try again:
drivers/net/irda/vlsi_ir.c: In function ‘vlsi_proc_ring’:drivers/net/irda/vlsi_ir.c:327:39: warning: comparison of distinct pointer types lacks a cast [enabled by default]
The types on each side of the min() expression are different, so the compiler warns. You probably need to use min_t() or similar, and carefuly examine the possible effects of signed overflow etc.