[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201214182117.1bbc717d@gandalf.local.home>
Date: Mon, 14 Dec 2020 18:21:17 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: David Laight <David.Laight@...LAB.COM>
Cc: 'Bean Huo' <huobean@...il.com>,
"alim.akhtar@...sung.com" <alim.akhtar@...sung.com>,
"avri.altman@....com" <avri.altman@....com>,
"asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"stanley.chu@...iatek.com" <stanley.chu@...iatek.com>,
"beanhuo@...ron.com" <beanhuo@...ron.com>,
"bvanassche@....org" <bvanassche@....org>,
"tomas.winkler@...el.com" <tomas.winkler@...el.com>,
"cang@...eaurora.org" <cang@...eaurora.org>,
"joe@...ches.com" <joe@...ches.com>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 1/6] scsi: ufs: Remove stringize operator '#'
restriction
On Mon, 14 Dec 2020 23:11:40 +0000
David Laight <David.Laight@...LAB.COM> wrote:
> > ---
> > include/trace/events/ufs.h | 40 +++++++++++++++++++-------------------
> > 1 file changed, 20 insertions(+), 20 deletions(-)
> >
> > diff --git a/include/trace/events/ufs.h b/include/trace/events/ufs.h
> > index 0bd54a184391..fa755394bc0f 100644
> > --- a/include/trace/events/ufs.h
> > +++ b/include/trace/events/ufs.h
> > @@ -20,28 +20,28 @@
> ..
> > +#define UFS_LINK_STATES \
> > + EM(UIC_LINK_OFF_STATE, "UIC_LINK_OFF_STATE") \
> > + EM(UIC_LINK_ACTIVE_STATE, "UIC_LINK_ACTIVE_STATE") \
> > + EMe(UIC_LINK_HIBERN8_STATE, "UIC_LINK_HIBERN8_STATE")
>
> If you make EM a parameter to UFS_LINK_STATES then the caller
> can pass in the name of a #define that does the required expansion.
> The caller can also add in any required terminator after the last entry.
> For an enum (which doesn't want a , at the end) just add a dummy entry.
> You often want a constant for the number of items anyway.
This is currently the way its done in multiple other places. When creating
the "EMe" trick, I've thought about it, but then realized it would make the
other locations look strange without the expected comma, and decided that
EMe() would be the best solution, as it's only strange in where it's added,
and not where its used.
$ git grep -l EMe include/trace/ |wc -l
11
It's already used in 11 other files, let's not muck with it now.
-- Steve
Powered by blists - more mailing lists