From: Jonathan Cameron <jic23@kernel.org>
To: Peter Meerwald <pmeerw@pmeerw.net>, linux-iio@vger.kernel.org
Cc: srinivas.pandruvada@linux.intel.com
Subject: Re: [PATCH] iio: Fix endianness issue in ak8975_read_axis()
Date: Sat, 07 Jun 2014 11:51:08 +0100 [thread overview]
Message-ID: <5392EE9C.60901@kernel.org> (raw)
In-Reply-To: <1401958410-21183-1-git-send-email-pmeerw@pmeerw.net>
On 05/06/14 09:53, Peter Meerwald wrote:
> i2c_smbus_read_word_data() does host endian conversion already,
> no need for le16_to_cpu()
>
> Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks
> ---
> drivers/iio/magnetometer/ak8975.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
> index 09ea5c4..ea08313 100644
> --- a/drivers/iio/magnetometer/ak8975.c
> +++ b/drivers/iio/magnetometer/ak8975.c
> @@ -373,8 +373,6 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val)
> {
> struct ak8975_data *data = iio_priv(indio_dev);
> struct i2c_client *client = data->client;
> - u16 meas_reg;
> - s16 raw;
> int ret;
>
> mutex_lock(&data->lock);
> @@ -422,16 +420,11 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val)
> dev_err(&client->dev, "Read axis data fails\n");
> goto exit;
> }
> - meas_reg = ret;
>
> mutex_unlock(&data->lock);
>
> - /* Endian conversion of the measured values. */
> - raw = (s16) (le16_to_cpu(meas_reg));
> -
> /* Clamp to valid range. */
> - raw = clamp_t(s16, raw, -4096, 4095);
> - *val = raw;
> + *val = clamp_t(s16, ret, -4096, 4095);
> return IIO_VAL_INT;
>
> exit:
>
prev parent reply other threads:[~2014-06-07 10:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 8:53 [PATCH] iio: Fix endianness issue in ak8975_read_axis() Peter Meerwald
2014-06-05 17:08 ` Srinivas Pandruvada
2014-06-05 18:17 ` Peter Meerwald
2014-06-05 19:03 ` Srinivas Pandruvada
2014-06-07 10:51 ` 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=5392EE9C.60901@kernel.org \
--to=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=srinivas.pandruvada@linux.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.