public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Michael Hennerich" <michael.hennerich@analog.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"kernel test robot" <lkp@intel.com>
Subject: Re: [PATCH v2 2/2] iio: adc: ad7380: don't use bool in FIELD_PREP
Date: Sun, 4 Feb 2024 14:46:07 +0000	[thread overview]
Message-ID: <20240204144607.2908b8b4@jic23-huawei> (raw)
In-Reply-To: <20240129195611.701611-3-dlechner@baylibre.com>

On Mon, 29 Jan 2024 13:56:08 -0600
David Lechner <dlechner@baylibre.com> wrote:

> Although this technically works, it is better to avoid using bool as
> a bit value.
> 
> Fixes sparse warning:
> 
>      drivers/iio/adc/ad7380.c:353:34: sparse: sparse: dubious: x & !y
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202401280629.5kknB57C-lkp@intel.com/
> Signed-off-by: David Lechner <dlechner@baylibre.com>
Applied.
> ---
> 
> v2 changes:
> * use correct terinary operator syntax (had typo of : instead of ?)
> 
>  drivers/iio/adc/ad7380.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index 44b8b18ab213..abd746aef868 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -350,7 +350,8 @@ static int ad7380_init(struct ad7380_state *st)
>  	/* select internal or external reference voltage */
>  	ret = regmap_update_bits(st->regmap, AD7380_REG_ADDR_CONFIG1,
>  				 AD7380_CONFIG1_REFSEL,
> -				 FIELD_PREP(AD7380_CONFIG1_REFSEL, !!st->vref));
> +				 FIELD_PREP(AD7380_CONFIG1_REFSEL,
> +					    st->vref ? 1 : 0));
>  	if (ret < 0)
>  		return ret;
>  


      reply	other threads:[~2024-02-04 14:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 19:56 [PATCH v2 0/2] iio: adc: ad7380: fix sparse warnings David Lechner
2024-01-29 19:56 ` [PATCH v2 1/2] iio: adc: ad7380: make ad7380_regmap_config static David Lechner
2024-01-29 19:56 ` [PATCH v2 2/2] iio: adc: ad7380: don't use bool in FIELD_PREP David Lechner
2024-02-04 14:46   ` 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=20240204144607.2908b8b4@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=michael.hennerich@analog.com \
    --cc=nuno.sa@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox