All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Slawomir Stepien <sst@poczta.fm>
Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de,
	pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
	gregkh@linuxfoundation.org
Subject: Re: [PATCH 1/1] staging: iio: adc: ad7280a: don't cast type inside switch expression
Date: Sun, 28 Oct 2018 18:59:21 +0000	[thread overview]
Message-ID: <20181028185921.732e8ce0@archlinux> (raw)
In-Reply-To: <20181026165310.16545-1-sst@poczta.fm>

On Fri, 26 Oct 2018 18:53:10 +0200
Slawomir Stepien <sst@poczta.fm> wrote:

> The type promotion will kick in, so the comparison will work.
> 
> Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Looks good to me.  Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/adc/ad7280a.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
> index b736275c10f5..7de6be4f0c27 100644
> --- a/drivers/staging/iio/adc/ad7280a.c
> +++ b/drivers/staging/iio/adc/ad7280a.c
> @@ -610,7 +610,7 @@ static ssize_t ad7280_read_channel_config(struct device *dev,
>  	struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
>  	unsigned int val;
>  
> -	switch ((u32)this_attr->address) {
> +	switch (this_attr->address) {
>  	case AD7280A_CELL_OVERVOLTAGE:
>  		val = 1000 + (st->cell_threshhigh * 1568) / 100;
>  		break;
> @@ -646,7 +646,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev,
>  	if (ret)
>  		return ret;
>  
> -	switch ((u32)this_attr->address) {
> +	switch (this_attr->address) {
>  	case AD7280A_CELL_OVERVOLTAGE:
>  	case AD7280A_CELL_UNDERVOLTAGE:
>  		val = ((val - 1000) * 100) / 1568; /* LSB 15.68mV */
> @@ -662,7 +662,7 @@ static ssize_t ad7280_write_channel_config(struct device *dev,
>  	val = clamp(val, 0L, 0xFFL);
>  
>  	mutex_lock(&st->lock);
> -	switch ((u32)this_attr->address) {
> +	switch (this_attr->address) {
>  	case AD7280A_CELL_OVERVOLTAGE:
>  		st->cell_threshhigh = val;
>  		break;

      reply	other threads:[~2018-10-29  3:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 16:53 [PATCH 1/1] staging: iio: adc: ad7280a: don't cast type inside switch expression Slawomir Stepien
2018-10-28 18:59 ` 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=20181028185921.732e8ce0@archlinux \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=sst@poczta.fm \
    /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.