Message ID | 20180722185031.1554-1-timschumi@gmx.de (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | input/iforce: Reformat the packet dump output | expand |
Hi Tim, On Sun, Jul 22, 2018 at 08:50:31PM +0200, Tim Schumacher wrote: > Currently, packets that are dumped are printed as > following in the kernel log: > > drivers/input/joystick/iforce/iforce-packets.c: info cmd = ff04, data = > 56 > 02 > 04 > 00 > > Make it more appealing and readable by concatenating the data output > into one line and shortening the previous file path down to "iforce". > The reformatted message would then look like this: > > iforce: dump_packet info cmd = ff04, data = 56 02 04 00 > --- > drivers/input/joystick/iforce/iforce-packets.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c > index 08f98f2eaf88..e7fa84874b6e 100644 > --- a/drivers/input/joystick/iforce/iforce-packets.c > +++ b/drivers/input/joystick/iforce/iforce-packets.c > @@ -37,10 +37,9 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data) > { > int i; > > - printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd); > + printk(KERN_DEBUG "iforce: dump_packet %s cmd = %04x, data = ", msg, cmd); > for (i = 0; i < LO(cmd); i++) > - printk("%02x ", data[i]); > - printk("\n"); > + printk(KERN_CONT "%02x ", data[i]); If we do that, let's do it properly: - pass iforce object into the function - dev_dbg(iforce->dev->dev.parent, "dump_packet %s cmd = %04x, data = %.*ph\n", msg, cmd, LO(cmd), data); Thanks.
diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index 08f98f2eaf88..e7fa84874b6e 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -37,10 +37,9 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data) { int i; - printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd); + printk(KERN_DEBUG "iforce: dump_packet %s cmd = %04x, data = ", msg, cmd); for (i = 0; i < LO(cmd); i++) - printk("%02x ", data[i]); - printk("\n"); + printk(KERN_CONT "%02x ", data[i]); } /*