linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [3/4] usb: dwc3: trace: log ep commands in hex
@ 2018-08-20 10:30 Felipe Balbi
  0 siblings, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2018-08-20 10:30 UTC (permalink / raw)
  To: linux-usb; +Cc: laurent.pinchart, Felipe Balbi

They are much more useful in hexadecimal than in decimal. Moreover,
generic commands are already logged in hex.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
 drivers/usb/dwc3/trace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
index f22714cce070..50fb6f2d92dd 100644
--- a/drivers/usb/dwc3/trace.h
+++ b/drivers/usb/dwc3/trace.h
@@ -199,7 +199,7 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
 		__entry->param2 = params->param2;
 		__entry->cmd_status = cmd_status;
 	),
-	TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status: %s",
+	TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status: %s",
 		__get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
 		__entry->cmd, __entry->param0,
 		__entry->param1, __entry->param2,

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [3/4] usb: dwc3: trace: log ep commands in hex
@ 2018-08-20 11:25 Laurent Pinchart
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2018-08-20 11:25 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb

Hi Felipe,

Thank you for the patch.

On Monday, 20 August 2018 13:30:00 EEST Felipe Balbi wrote:
> They are much more useful in hexadecimal than in decimal. Moreover,
> generic commands are already logged in hex.
> 
> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
> ---
>  drivers/usb/dwc3/trace.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
> index f22714cce070..50fb6f2d92dd 100644
> --- a/drivers/usb/dwc3/trace.h
> +++ b/drivers/usb/dwc3/trace.h
> @@ -199,7 +199,7 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd,
>  		__entry->param2 = params->param2;
>  		__entry->cmd_status = cmd_status;
>  	),
> -	TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status: %s",
> +	TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status: %s",

How about 0x%x ? Otherwise one could get confused when the command 
representation in hex doesn't contain a letter (especially given that this 
patch transitions from decimal to hexadecimal).

>  		__get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd),
>  		__entry->cmd, __entry->param0,
>  		__entry->param1, __entry->param2,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [3/4] usb: dwc3: trace: log ep commands in hex
@ 2018-08-20 12:06 Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2018-08-20 12:06 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Felipe Balbi, USB

On Mon, Aug 20, 2018 at 2:25 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:

>> -     TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status: %s",
>> +     TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status: %s",
>
> How about 0x%x ?

Side note: # is one character less for the same.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [3/4] usb: dwc3: trace: log ep commands in hex
@ 2018-08-20 12:22 Laurent Pinchart
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2018-08-20 12:22 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Felipe Balbi, USB

Hi Andy,

On Monday, 20 August 2018 15:06:31 EEST Andy Shevchenko wrote:
> On Mon, Aug 20, 2018 at 2:25 PM, Laurent Pinchart wrote:
> >> -     TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status: %s",
> >> +     TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status: %s",
> > 
> > How about 0x%x ?
> 
> Side note: # is one character less for the same.

Doesn't that print 0 instead of 0x0 ? There's no ambiguity with 0, but I find 
that always printing the 0x is more consistent. I'll leave that up to Felipe, 
I'm OK with both options.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [3/4] usb: dwc3: trace: log ep commands in hex
@ 2018-08-23  9:57 Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2018-08-23  9:57 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Felipe Balbi, USB

On Mon, Aug 20, 2018 at 3:21 PM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hi Andy,
>
> On Monday, 20 August 2018 15:06:31 EEST Andy Shevchenko wrote:
> > On Mon, Aug 20, 2018 at 2:25 PM, Laurent Pinchart wrote:
> > >> -     TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status: %s",
> > >> +     TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status: %s",
> > >
> > > How about 0x%x ?
> >
> > Side note: # is one character less for the same.
>
> Doesn't that print 0 instead of 0x0 ? There's no ambiguity with 0, but I find
> that always printing the 0x is more consistent. I'll leave that up to Felipe,
> I'm OK with both options.

       #      The value should be converted to an "alternate form".
For o conversions, the first character  of
             the  output  string is made zero (by prefixing a 0 if it
was not zero already).  For x and X con‐
             versions, a nonzero result has the string "0x" (or "0X"
for X conversions) prepended to it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [3/4] usb: dwc3: trace: log ep commands in hex
@ 2018-08-23 12:03 Laurent Pinchart
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2018-08-23 12:03 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Felipe Balbi, USB

Hi Andy,

On Thursday, 23 August 2018 12:57:57 EEST Andy Shevchenko wrote:
> On Mon, Aug 20, 2018 at 3:21 PM Laurent Pinchart wrote:
> > On Monday, 20 August 2018 15:06:31 EEST Andy Shevchenko wrote:
> >> On Mon, Aug 20, 2018 at 2:25 PM, Laurent Pinchart wrote:
> >>>> -     TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x --> status:
> >>>> %s",
> >>>> +     TP_printk("%s: cmd '%s' [%x] params %08x %08x %08x --> status:
> >>>> %s",
> >>> 
> >>> How about 0x%x ?
> >> 
> >> Side note: # is one character less for the same.
> > 
> > Doesn't that print 0 instead of 0x0 ? There's no ambiguity with 0, but I
> > find that always printing the 0x is more consistent. I'll leave that up
> > to Felipe, I'm OK with both options.
> 
>        #      The value should be converted to an "alternate form".
> For o conversions, the first character  of
>              the  output  string is made zero (by prefixing a 0 if it
> was not zero already).  For x and X con‐
>              versions, a nonzero result has the string "0x" (or "0X"
> for X conversions) prepended to it.

That's exactly my point, it will only prepend 0x when the value is not zero. 
Small inconsistency, but I don't mind too much.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-23 12:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-23 12:03 [3/4] usb: dwc3: trace: log ep commands in hex Laurent Pinchart
  -- strict thread matches above, loose matches on Subject: below --
2018-08-23  9:57 Andy Shevchenko
2018-08-20 12:22 Laurent Pinchart
2018-08-20 12:06 Andy Shevchenko
2018-08-20 11:25 Laurent Pinchart
2018-08-20 10:30 Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).