[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240221133510.70b9c205@gandalf.local.home>
Date: Wed, 21 Feb 2024 13:35:10 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Vilas Bhat <vilasbhat@...gle.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Pavel Machek <pavel@....cz>,
Len Brown <len.brown@...el.com>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Saravana Kannan
<saravanak@...gle.com>, kernel-team@...roid.com, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH v1] PM: runtime: add tracepoint for runtime_status
changes
On Wed, 21 Feb 2024 09:57:03 -0800
Vilas Bhat <vilasbhat@...gle.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
Powered by blists - more mailing lists