All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Bean Huo' <huobean@gmail.com>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"avri.altman@wdc.com" <avri.altman@wdc.com>,
	"asutoshd@codeaurora.org" <asutoshd@codeaurora.org>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"stanley.chu@mediatek.com" <stanley.chu@mediatek.com>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"tomas.winkler@intel.com" <tomas.winkler@intel.com>,
	"cang@codeaurora.org" <cang@codeaurora.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"joe@perches.com" <joe@perches.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v3 1/6] scsi: ufs: Remove stringize operator '#' restriction
Date: Mon, 14 Dec 2020 23:11:40 +0000	[thread overview]
Message-ID: <977f3ea155644cd89bc83f2e9dcf281e@AcuMS.aculab.com> (raw)
In-Reply-To: <20201214202014.13835-2-huobean@gmail.com>

From: Bean Huo <huobean@gmail.com>
> Sent: 14 December 2020 20:20
> 
> From: Bean Huo <beanhuo@micron.com>
> 
> Current EM macro definition, we use stringize operator '#', which turns
> the argument it precedes into a quoted string. Thus requires the symbol
> of __print_symbolic() should be the string corresponding to the name of
> the enum.
> 
> However, we have other cases, the symbol and enum name are not the same,
> we can redefine EM/EMe, but there will introduce some redundant codes.
> This patch is to remove this restriction, let others reuse the current
> EM/EMe definition.
> 
> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
>  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.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  parent reply	other threads:[~2020-12-14 23:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 20:20 [PATCH v3 0/6] Several changes for the UPIU trace Bean Huo
2020-12-14 20:20 ` [PATCH v3 1/6] scsi: ufs: Remove stringize operator '#' restriction Bean Huo
2020-12-14 21:23   ` Joe Perches
2020-12-14 22:26     ` Bean Huo
2020-12-14 23:11   ` David Laight [this message]
2020-12-14 23:21     ` Steven Rostedt
2020-12-14 20:20 ` [PATCH v3 2/6] scsi: ufs: Use __print_symbolic() for UFS trace string print Bean Huo
2020-12-14 20:20 ` [PATCH v3 3/6] scsi: ufs: Don't call trace_ufshcd_upiu() in case trace poit is disabled Bean Huo
2020-12-14 20:20 ` [PATCH v3 4/6] scsi: ufs: Distinguish between query REQ and query RSP in query trace Bean Huo
2020-12-14 20:20 ` [PATCH v3 5/6] scsi: ufs: Distinguish between TM request UPIU and response UPIU in TM UPIU trace Bean Huo
2020-12-14 20:20 ` [PATCH v3 6/6] scsi: ufs: Make UPIU trace easier differentiate among CDB, OSF, and TM Bean Huo
2020-12-14 22:13 ` [PATCH v3 0/6] Several changes for the UPIU trace Avri Altman
2020-12-14 22:37   ` Bean Huo
2020-12-15 22:18     ` Bean Huo
2021-01-04 20:39       ` Bean Huo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=977f3ea155644cd89bc83f2e9dcf281e@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=huobean@gmail.com \
    --cc=jejb@linux.ibm.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=rostedt@goodmis.org \
    --cc=stanley.chu@mediatek.com \
    --cc=tomas.winkler@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.