mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-26 04:35:01 +00:00
i40e: re-use %*ph specifier to hexdump a data
Instead of using a custom approach change the code to use %*ph format specifier. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
0e320516b2
commit
a3524e95ac
@ -331,25 +331,11 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
|
||||
len = buf_len;
|
||||
/* write the full 16-byte chunks */
|
||||
for (i = 0; i < (len - 16); i += 16)
|
||||
i40e_debug(hw, mask,
|
||||
"\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",
|
||||
i, buf[i], buf[i + 1], buf[i + 2],
|
||||
buf[i + 3], buf[i + 4], buf[i + 5],
|
||||
buf[i + 6], buf[i + 7], buf[i + 8],
|
||||
buf[i + 9], buf[i + 10], buf[i + 11],
|
||||
buf[i + 12], buf[i + 13], buf[i + 14],
|
||||
buf[i + 15]);
|
||||
i40e_debug(hw, mask, "\t0x%04X %16ph\n", i, buf + i);
|
||||
/* write whatever's left over without overrunning the buffer */
|
||||
if (i < len) {
|
||||
char d_buf[80];
|
||||
int j = 0;
|
||||
|
||||
memset(d_buf, 0, sizeof(d_buf));
|
||||
j += sprintf(d_buf, "\t0x%04X ", i);
|
||||
while (i < len)
|
||||
j += sprintf(&d_buf[j], " %02X", buf[i++]);
|
||||
i40e_debug(hw, mask, "%s\n", d_buf);
|
||||
}
|
||||
if (i < len)
|
||||
i40e_debug(hw, mask, "\t0x%04X %*ph\n",
|
||||
i, len - i, buf + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,25 +331,11 @@ void i40evf_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
|
||||
len = buf_len;
|
||||
/* write the full 16-byte chunks */
|
||||
for (i = 0; i < (len - 16); i += 16)
|
||||
i40e_debug(hw, mask,
|
||||
"\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",
|
||||
i, buf[i], buf[i + 1], buf[i + 2],
|
||||
buf[i + 3], buf[i + 4], buf[i + 5],
|
||||
buf[i + 6], buf[i + 7], buf[i + 8],
|
||||
buf[i + 9], buf[i + 10], buf[i + 11],
|
||||
buf[i + 12], buf[i + 13], buf[i + 14],
|
||||
buf[i + 15]);
|
||||
i40e_debug(hw, mask, "\t0x%04X %16ph\n", i, buf + i);
|
||||
/* write whatever's left over without overrunning the buffer */
|
||||
if (i < len) {
|
||||
char d_buf[80];
|
||||
int j = 0;
|
||||
|
||||
memset(d_buf, 0, sizeof(d_buf));
|
||||
j += sprintf(d_buf, "\t0x%04X ", i);
|
||||
while (i < len)
|
||||
j += sprintf(&d_buf[j], " %02X", buf[i++]);
|
||||
i40e_debug(hw, mask, "%s\n", d_buf);
|
||||
}
|
||||
if (i < len)
|
||||
i40e_debug(hw, mask, "\t0x%04X %*ph\n",
|
||||
i, len - i, buf + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user