Re: [PATCH 2/2] usb: core: Add tracepoints for device allocation and state changes

From: Greg Kroah-Hartman

Date: Tue Oct 14 2025 - 01:17:57 EST


On Mon, Oct 13, 2025 at 11:24:47PM -0400, Alan Stern wrote:
> On Tue, Oct 14, 2025 at 08:05:25AM +0800, Kuen-Han Tsai wrote:
> > Hi Alan,
> >
> > On Mon, Oct 13, 2025 at 9:20 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > Suggestion: Rather than printing the meaningless numerical value of
> > > __entry->state, print the string value returned by
> > > usb_state_string(__entry->state).
> >
> > I kept it consistent with the udc_log_gadget tracepoint, which also
> > uses the numerical value for the USB state.
> >
> > If we change the state to a string, should we convert the speed field
> > to a string using usb_speed_string()?
> >
> > I lean toward keeping both as numerical values, but I am happy to
> > switch both to strings if you prefer. Please let me know what you
> > think is best.
>
> I agree that if one of them uses strings then so should the other.
>
> As for whether you should change them... I don't care very much, since
> I haven't used tracepoints in my gadget debugging. I was just thinking
> of what other people might like.
>
> Greg, do you have a recommendation?

Strings are always easier for people to understand, otherwise we have to
go look the value up somewhere. So both should use them.

thanks,

greg k-h