linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Teodora Baluta <teodora.baluta@intel.com>,
	linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH 2/5] staging: iio: ad5933: fix sparse warning cast to restricted __be16
Date: Sat, 02 Aug 2014 12:57:56 +0100	[thread overview]
Message-ID: <53DCD244.4070801@kernel.org> (raw)
In-Reply-To: <1406546313-23031-3-git-send-email-teodora.baluta@intel.com>

On 28/07/14 12:18, Teodora Baluta wrote:
> Fix the following sparse endianness warnings:
> 
>   CHECK   drivers/staging/iio/impedance-analyzer/ad5933.c
> drivers/staging/iio/impedance-analyzer/ad5933.c:674:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:674:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:674:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:674:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:675:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:675:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:675:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:675:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:677:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:677:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:677:34: warning: cast to
> restricted __be16
> drivers/staging/iio/impedance-analyzer/ad5933.c:677:34: warning: cast to
> restricted __be16
> 
> Signed-off-by: Teodora Baluta <teodora.baluta@intel.com>
Again, I'd prefer the introduction of a specific be16 variable to
make it very clear what is going on rather that what we have
here which is papering over the warning.

J
> ---
>  drivers/staging/iio/impedance-analyzer/ad5933.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
> index 2cef4b9..87ce844 100644
> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
> @@ -647,7 +647,7 @@ static void ad5933_work(struct work_struct *work)
>  	struct ad5933_state *st = container_of(work,
>  		struct ad5933_state, work.work);
>  	struct iio_dev *indio_dev = i2c_get_clientdata(st->client);
> -	signed short buf[2];
> +	u16 buf[2];
>  	unsigned char status;
>  
>  	mutex_lock(&indio_dev->mlock);
> @@ -671,10 +671,10 @@ static void ad5933_work(struct work_struct *work)
>  				scan_count * 2, (u8 *)buf);
>  
>  		if (scan_count == 2) {
> -			buf[0] = be16_to_cpu(buf[0]);
> -			buf[1] = be16_to_cpu(buf[1]);
> +			be16_to_cpus(&buf[0]);
> +			be16_to_cpus(&buf[1]);
>  		} else {
> -			buf[0] = be16_to_cpu(buf[0]);
> +			be16_to_cpus(&buf[0]);
>  		}
>  		iio_push_to_buffers(indio_dev, buf);
>  	} else {
> 

  reply	other threads:[~2014-08-02 11:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-28 11:18 [PATCH 0/5] staging: iio: minor fixes for sparse warnings Teodora Baluta
2014-07-28 11:18 ` [PATCH 1/5] staging: iio: ad7816: fix sparse warning cast to restricted __be16 Teodora Baluta
2014-08-02 11:56   ` Jonathan Cameron
2014-07-28 11:18 ` [PATCH 2/5] staging: iio: ad5933: " Teodora Baluta
2014-08-02 11:57   ` Jonathan Cameron [this message]
2014-07-28 11:18 ` [PATCH 3/5] staging: iio: hmc5843_core: fix sparse warnings Teodora Baluta
2014-08-02 16:33   ` Jonathan Cameron
2014-07-28 11:18 ` [PATCH 4/5] staging: iio: isl29018: fix sparse warning regarding incorrect type (different signedness) Teodora Baluta
2014-08-02 16:35   ` Jonathan Cameron
2014-07-28 11:18 ` [PATCH 5/5] staging: iio: adis16240: fix sparse warnings regarding incorrect argument type Teodora Baluta
2014-08-02 16:44   ` Jonathan Cameron

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=53DCD244.4070801@kernel.org \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=teodora.baluta@intel.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;
as well as URLs for NNTP newsgroup(s).