platform/chrome: cros_ec_spi: Use %*ph for printing hexdump of a small buffer
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 12 Jun 2023 21:23:36 +0000 (00:23 +0300)
committerTzung-Bi Shih <tzungbi@kernel.org>
Tue, 13 Jun 2023 04:28:36 +0000 (12:28 +0800)
The kernel already has a helper to print a hexdump of a small
buffer via pointer extension. Use that instead of open coded
variant.

In long term it helps to kill pr_cont() or at least narrow down
its use.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230612212336.4961-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_spi.c

index 21143dba8970472890cee4f91f305035552952a5..3e88cc92e819223e5e26778ce26a64643028ccda 100644 (file)
@@ -104,13 +104,7 @@ static void debug_packet(struct device *dev, const char *name, u8 *ptr,
                         int len)
 {
 #ifdef DEBUG
-       int i;
-
-       dev_dbg(dev, "%s: ", name);
-       for (i = 0; i < len; i++)
-               pr_cont(" %02x", ptr[i]);
-
-       pr_cont("\n");
+       dev_dbg(dev, "%s: %*ph\n", name, len, ptr);
 #endif
 }