]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: fddi: skfp: Use print_hex_dump() helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 23 Jan 2020 14:27:29 +0000 (16:27 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Jan 2020 09:15:49 +0000 (10:15 +0100)
Use the print_hex_dump() helper, instead of open-coding the same operations.

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

index 15754451cb876ba75fa4f1db05bce73dc6359469..69c29a2ef95db471c2d32f8cea3ece99e2821dad 100644 (file)
@@ -1520,22 +1520,8 @@ void mac_drv_tx_complete(struct s_smc *smc, volatile struct s_smt_fp_txd *txd)
 #ifdef DUMPPACKETS
 void dump_data(unsigned char *Data, int length)
 {
-       int i, j;
-       unsigned char s[255], sh[10];
-       if (length > 64) {
-               length = 64;
-       }
        printk(KERN_INFO "---Packet start---\n");
-       for (i = 0, j = 0; i < length / 8; i++, j += 8)
-               printk(KERN_INFO "%02x %02x %02x %02x %02x %02x %02x %02x\n",
-                      Data[j + 0], Data[j + 1], Data[j + 2], Data[j + 3],
-                      Data[j + 4], Data[j + 5], Data[j + 6], Data[j + 7]);
-       strcpy(s, "");
-       for (i = 0; i < length % 8; i++) {
-               sprintf(sh, "%02x ", Data[j + i]);
-               strcat(s, sh);
-       }
-       printk(KERN_INFO "%s\n", s);
+       print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, Data, min_t(size_t, length, 64), false);
        printk(KERN_INFO "------------------\n");
 }                              // dump_data
 #else