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 1/5] staging: iio: ad7816: fix sparse warning cast to restricted __be16
Date: Sat, 02 Aug 2014 12:56:07 +0100 [thread overview]
Message-ID: <53DCD1D7.9000206@kernel.org> (raw)
In-Reply-To: <1406546313-23031-2-git-send-email-teodora.baluta@intel.com>
On 28/07/14 12:18, Teodora Baluta wrote:
> Fix following sparse endianness problems:
>
> CHECK drivers/staging/iio/adc/ad7816.c
> drivers/staging/iio/adc/ad7816.c:93:17: warning: cast to restricted
> __be16
> drivers/staging/iio/adc/ad7816.c:93:17: warning: cast to restricted
> __be16
> drivers/staging/iio/adc/ad7816.c:93:17: warning: cast to restricted
> __be16
> drivers/staging/iio/adc/ad7816.c:93:17: warning: cast to restricted
> __be16
>
> Signed-off-by: Teodora Baluta <teodora.baluta@intel.com>
Hi Teodora,
There's actually a nastier problem hiding in here. SPI requires that
the buffers passed to spi_read are in their own cache lines.
Here they are on the stack and hence this is unlikely to be true.
Cc'd Lars for info.
Also, in cases like this I'd prefer to introduce a local __be16 to
hold the value whilst it is big endian, rather than using it for both
big endian and cpu endian in different places in the code.
Thanks,
Jonathan
> ---
> drivers/staging/iio/adc/ad7816.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
> index 158d770..6686eac 100644
> --- a/drivers/staging/iio/adc/ad7816.c
> +++ b/drivers/staging/iio/adc/ad7816.c
> @@ -90,7 +90,7 @@ static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
> return ret;
> }
>
> - *data = be16_to_cpu(*data);
> + be16_to_cpus(data);
>
> return ret;
> }
>
next prev parent reply other threads:[~2014-08-02 11:56 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 [this message]
2014-07-28 11:18 ` [PATCH 2/5] staging: iio: ad5933: " Teodora Baluta
2014-08-02 11:57 ` Jonathan Cameron
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=53DCD1D7.9000206@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 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.