Re: [PATCH v1] PM: runtime: add tracepoint for runtime_status changes

From: Vilas Bhat
Date: Wed Feb 21 2024 - 13:41:23 EST


On Wed, Feb 21, 2024 at 10:33 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> On Wed, 21 Feb 2024 09:57:03 -0800
> Vilas Bhat <vilasbhat@xxxxxxxxxx> wrote:
>
> > > You could do what everyone else does:
> > >
> > > #define RPM_STATUS_STRINGS \
> > > EM( RPM_INVALID, "RPM_INVALID" ) \
> > > EM( RPM_ACTIVE, "RPM_ACTIVE" ) \
> > > EM( RPM_RESUMING, "RPM_RESUMING" ) \
> > > EM( RPM_SUSPENDED, "RPM_SUSPENDED" ) \
> > > EMe( RPM_SUSPENDING, "RPM_SUSPENDING" )
> > >
> > > #undef EM
> > > #undef EMe
> > > #define EM(a, b) TRACE_DEFINE_ENUM(a);
> > > #define EMe(a, b) TRACE_DEFINE_ENUM(a);
> > >
> > > RPM_STATUS_STRINGS
> > >
> > > #undef EM
> > > #undef EMe
> > > #define EM(a, b) { a, b },
> > > #define EMe(a, b) { a, b }
> > >
> >
> > Thanks for the comment, Steven. I did notice both methods of defining
> > enum values for tracepoints and chose this method because it felt
> > clearer. Could you clarify on why the method you suggested is
> > preferred?
> >
>
> Sure. One big reason: It removes duplication.
>
> If you add another enum to the list, you only need to update it in one
> place. And it prevents the two from getting out of sync.
>
> -- Steve

That makes sense! Thanks. I will revise the patch and send a new version soon.