Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Hegbeli, Ciprian" <Ciprian.Hegbeli@analog.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: CHECK: Macro argument reuse
Date: Sat, 5 Feb 2022 17:43:10 +0000	[thread overview]
Message-ID: <20220205174310.26786d5e@jic23-huawei> (raw)
In-Reply-To: <BYAPR03MB46478624466527B5263B83FF97279@BYAPR03MB4647.namprd03.prod.outlook.com>

On Wed, 2 Feb 2022 10:48:51 +0000
"Hegbeli, Ciprian" <Ciprian.Hegbeli@analog.com> wrote:

> Hi,
> 
> The driver I'm working on has channels which can be configured similarly but with small changes. In order to simplify the code, I used macros with arguments for the parts that are different.
> Unfortunately this leads to warnings during the checkpatch with --strict .
> 
> CHECK: Macro argument reuse 'num' - possible side-effects?
> +#define ADE9078_POWER_FACTOR_CHANNEL(num, name) {		\
> +	.type = IIO_POWER,						\
> +	.channel = num,							\
> +	.address = ADE9078_ADDR_ADJUST(ADE9078_REG_APF, num),	\
> +	.extend_name = name "_factor",				\
> +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |		\
> +			             BIT(IIO_CHAN_INFO_SCALE),		\
> +	.scan_index = -1						\
> +}
> 
> Is there any way to fix this warning without adding more arguments?
> In this case, can it be ignored?

It's a request to 'CHECK' that it looks right, not a warning or error
because it may well be fine.  In this case, I'd hope it's fine
as long as you are only passing constant values in for num.
So check what it asks you to check and if it's fine ignore the message.

Jonathan
> 
> Regards,
> Ciprian
> 


      reply	other threads:[~2022-02-05 17:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-02 10:48 CHECK: Macro argument reuse Hegbeli, Ciprian
2022-02-05 17:43 ` Jonathan Cameron [this message]

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=20220205174310.26786d5e@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Ciprian.Hegbeli@analog.com \
    --cc=linux-iio@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox