Re: [PATCH] input: byd: use %*ph for Z packet dump
From: Vivek BalachandharTN
Date: Wed Jan 14 2026 - 03:49:35 EST
Thanks Andy — good point. Packet length is fixed here, so |%4ph| is better. I’ll follow this pattern in future patches (and can send a small follow-up to adjust this one if desired).
Best, Vivek
On 2026-01-14 3:37 a.m., Andy Shevchenko wrote:
On Tue, Dec 02, 2025 at 03:31:20AM +0000, Vivek BalachandharTN wrote:
Replace the hand-rolled %02x formatting of the Z packet warning in theYou probably took one of the oldest examples of such a conversion done in
BYD driver with the %*ph format specifier. %*ph is the preferred helper
for printing a buffer in hexadecimal and makes the logging clearer and
more consistent.
the input subsystem.
+ "Unrecognized Z: pkt = %*ph\n",The (not-so-critical) problem here is the stack consumption and additional work
+ 4, psmouse->packet);
for the printf() to parse '*'. To optimise that, static field widths may be
embedded in the format strings
"Unrecognized Z: pkt = %4ph\n",
psmouse->packet);