lkml.org 
[lkml]   [2024]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1] PM: runtime: add tracepoint for runtime_status changes
On Wed, Feb 21, 2024 at 10:33 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Wed, 21 Feb 2024 09:57:03 -0800
> Vilas Bhat <vilasbhat@google.com> 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.

\
 
 \ /
  Last update: 2024-05-27 15:15    [W:0.037 / U:0.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site