linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Mark Brown <broonie@kernel.org>,
	Jean Delvare <khali@linux-fr.org>,
	Guenter Roeck <linux@roeck-us.net>,
	lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-spi@vger.kernel.org
Subject: Re: [PATCH 3/3] staging:iio:ade7753/ade7754/ade7759: Use spi_w8r16be() instead of spi_w8r16()
Date: Sat, 28 Sep 2013 11:42:43 +0100	[thread overview]
Message-ID: <5246B2A3.30809@kernel.org> (raw)
In-Reply-To: <1380292469-17347-3-git-send-email-lars@metafoo.de>

On 09/27/13 15:34, Lars-Peter Clausen wrote:
> Using spi_w8r16be() will do the conversion of the result from big endian to
> native endian in the helper function. This makes the code a bit smaller and also
> keeps sparse happy. Fixes the following sparse warnings:
> 
> 	drivers/staging/iio/meter/ade7753.c:97:29: warning: incorrect type in argument 1 (different base types)
> 	drivers/staging/iio/meter/ade7753.c:97:29:    expected restricted __be16 const [usertype] *p
> 	drivers/staging/iio/meter/ade7753.c:97:29:    got unsigned short [usertype] *val
> 
> 	drivers/staging/iio/meter/ade7754.c:97:29: warning: incorrect type in argument 1 (different base types)
> 	drivers/staging/iio/meter/ade7754.c:97:29:    expected restricted __be16 const [usertype] *p
> 	drivers/staging/iio/meter/ade7754.c:97:29:    got unsigned short [usertype] *val
> 
> 	drivers/staging/iio/meter/ade7759.c:97:29: warning: incorrect type in argument 1 (different base types)
> 	drivers/staging/iio/meter/ade7759.c:97:29:    expected restricted __be16 const [usertype] *p
> 	drivers/staging/iio/meter/ade7759.c:97:29:    got unsigned short [usertype] *val
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>

I'm also fine with the various alternative suggestions elsewhere in this thread.
> ---
>  drivers/staging/iio/meter/ade7753.c | 3 +--
>  drivers/staging/iio/meter/ade7754.c | 3 +--
>  drivers/staging/iio/meter/ade7759.c | 3 +--
>  3 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
> index 6200335..00492ca 100644
> --- a/drivers/staging/iio/meter/ade7753.c
> +++ b/drivers/staging/iio/meter/ade7753.c
> @@ -86,7 +86,7 @@ static int ade7753_spi_read_reg_16(struct device *dev,
>  	struct ade7753_state *st = iio_priv(indio_dev);
>  	ssize_t ret;
>  
> -	ret = spi_w8r16(st->us, ADE7753_READ_REG(reg_address));
> +	ret = spi_w8r16be(st->us, ADE7753_READ_REG(reg_address));
>  	if (ret < 0) {
>  		dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
>  			reg_address);
> @@ -94,7 +94,6 @@ static int ade7753_spi_read_reg_16(struct device *dev,
>  	}
>  
>  	*val = ret;
> -	*val = be16_to_cpup(val);
>  
>  	return 0;
>  }
> diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c
> index 2e046f6..e0aa13a 100644
> --- a/drivers/staging/iio/meter/ade7754.c
> +++ b/drivers/staging/iio/meter/ade7754.c
> @@ -86,7 +86,7 @@ static int ade7754_spi_read_reg_16(struct device *dev,
>  	struct ade7754_state *st = iio_priv(indio_dev);
>  	int ret;
>  
> -	ret = spi_w8r16(st->us, ADE7754_READ_REG(reg_address));
> +	ret = spi_w8r16be(st->us, ADE7754_READ_REG(reg_address));
>  	if (ret < 0) {
>  		dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
>  			reg_address);
> @@ -94,7 +94,6 @@ static int ade7754_spi_read_reg_16(struct device *dev,
>  	}
>  
>  	*val = ret;
> -	*val = be16_to_cpup(val);
>  
>  	return 0;
>  }
> diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c
> index 145f896..ea0c9de 100644
> --- a/drivers/staging/iio/meter/ade7759.c
> +++ b/drivers/staging/iio/meter/ade7759.c
> @@ -86,7 +86,7 @@ static int ade7759_spi_read_reg_16(struct device *dev,
>  	struct ade7759_state *st = iio_priv(indio_dev);
>  	int ret;
>  
> -	ret = spi_w8r16(st->us, ADE7759_READ_REG(reg_address));
> +	ret = spi_w8r16be(st->us, ADE7759_READ_REG(reg_address));
>  	if (ret < 0) {
>  		dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
>  			reg_address);
> @@ -94,7 +94,6 @@ static int ade7759_spi_read_reg_16(struct device *dev,
>  	}
>  
>  	*val = ret;
> -	*val = be16_to_cpup(val);
>  
>  	return 0;
>  }
> 

  reply	other threads:[~2013-09-28  9:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 14:34 [PATCH 1/3] spi: Add a spi_w8r16be() helper Lars-Peter Clausen
2013-09-27 14:34 ` [PATCH 2/3] hwmon: (adt7310) Use spi_w8r16be() instead spi_w8r16() Lars-Peter Clausen
2013-09-27 16:12   ` Guenter Roeck
2013-10-03 12:53   ` Mark Brown
2013-09-27 14:34 ` [PATCH 3/3] staging:iio:ade7753/ade7754/ade7759: Use spi_w8r16be() instead of spi_w8r16() Lars-Peter Clausen
2013-09-28 10:42   ` Jonathan Cameron [this message]
2013-09-27 18:34 ` [PATCH 1/3] spi: Add a spi_w8r16be() helper Mark Brown
2013-09-27 18:46   ` Lars-Peter Clausen
2013-09-27 19:22     ` Mark Brown
2013-09-27 20:01       ` Lars-Peter Clausen
2013-09-29 12:30         ` Mark Brown
2013-10-03 10:39           ` Lars-Peter Clausen
2013-10-03 10:59             ` Mark Brown
2013-09-27 20:42       ` Guenter Roeck
2013-10-03 12:52 ` Mark Brown

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=5246B2A3.30809@kernel.org \
    --to=jic23@kernel.org \
    --cc=broonie@kernel.org \
    --cc=khali@linux-fr.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.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;
as well as URLs for NNTP newsgroup(s).