irda: vlsi_ir: use %*ph specifier
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 9 Sep 2014 08:48:29 +0000 (11:48 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Sep 2014 03:10:44 +0000 (20:10 -0700)
Instead of looping in the code let's use kernel extension to dump small
buffers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/irda/vlsi_ir.c

index a04af9d..a2e5561 100644 (file)
@@ -324,12 +324,8 @@ static void vlsi_proc_ring(struct seq_file *seq, struct vlsi_ring *r)
                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");
+                       seq_printf(seq, "   data: %*ph\n",
+                                  min_t(unsigned, j, 20), rd->buf);
                }
        }
        for (i = 0; i < r->size; i++) {