All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH] iio: adc: max9611: Avoid implicit enum conversion warning
Date: Sun, 16 Sep 2018 10:53:51 +0100	[thread overview]
Message-ID: <20180916105351.1bf859ee@archlinux> (raw)
In-Reply-To: <20180915052511.2243-1-natechancellor@gmail.com>

On Fri, 14 Sep 2018 22:25:11 -0700
Nathan Chancellor <natechancellor@gmail.com> wrote:

> Clang warns when an enumerated type is implicitly converted to another.
> 
> drivers/iio/adc/max9611.c:292:16: warning: implicit conversion from
> enumeration type 'enum max9611_conf_ids' to different enumeration type
> 'enum max9611_csa_gain' [-Wenum-conversion]
>                         *csa_gain = gain_selectors[i];
>                                   ~ ^~~~~~~~~~~~~~~~~
> 1 warning generated.
> 
> Change the type of the variable 'gain_selectors' to int so that Clang
> understands this is expected behavior.
> 
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
How does this interact with the patch that Stefan Agner sent for
the same issue last week?

https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?h=testing&id=b1ec0802503820ccbc894aadfd2a44da20232f5e

Thanks,

Jonathan

> ---
>  drivers/iio/adc/max9611.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c
> index 0538ff8c4ac1..3c358b16a8fa 100644
> --- a/drivers/iio/adc/max9611.c
> +++ b/drivers/iio/adc/max9611.c
> @@ -275,7 +275,7 @@ static int max9611_read_csa_voltage(struct max9611_dev *max9611,
>  				    u16 *adc_raw,
>  				    enum max9611_csa_gain *csa_gain)
>  {
> -	enum max9611_conf_ids gain_selectors[] = {
> +	int gain_selectors[] = {
>  		CONF_SENSE_1x,
>  		CONF_SENSE_4x,
>  		CONF_SENSE_8x

  reply	other threads:[~2018-09-16 15:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-15  5:25 [PATCH] iio: adc: max9611: Avoid implicit enum conversion warning Nathan Chancellor
2018-09-16  9:53 ` Jonathan Cameron [this message]
2018-09-16 15:15   ` Nathan Chancellor
2018-09-17 16:52     ` Nick Desaulniers
2018-09-17 19:22       ` Stefan Agner

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=20180916105351.1bf859ee@archlinux \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=pmeerw@pmeerw.net \
    /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.