From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>,
Hans de Goede <hdegoede@redhat.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v2] iio: accel: Add driver for the MiraMEMS DA311 3-axis 12-bit digital accelerometer
Date: Sun, 25 Sep 2016 17:44:03 +0100 [thread overview]
Message-ID: <e8cdc33b-5331-7e25-8bdb-823cd462644f@kernel.org> (raw)
In-Reply-To: <cb187395-d50d-ff10-c58e-7e68f5fab4f8@metafoo.de>
On 25/09/16 16:11, Lars-Peter Clausen wrote:
> On 09/22/2016 03:42 PM, Hans de Goede wrote:
> [...]
>> + switch (mask) {
>> + case IIO_CHAN_INFO_RAW:
>> + ret = i2c_smbus_read_word_data(data->client, chan->address);
>> + if (ret < 0)
>> + return ret;
>> + /*
>> + * Values are 12 bits, stored as 16 bits with the 4
>> + * least significant bits always 0.
>> + */
>> + *val = ((short)le16_to_cpu(ret)) >> 4;
>
> I think the le16_to_cpu() is a leftover from the switch away from
> i2c_smbus_read_i2c_block_data(). i2c_smbus_read_word_data() already returns
> CPU endianess data. On a BE system le16_to_cpu() swaps the lower and upper
> bytes on a BE system. So you'd get the wrong value in that case.
Backed out. Please check the scale value as well for v3.
Thanks,
Jonathan
>
>> + return IIO_VAL_INT;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
prev parent reply other threads:[~2016-09-25 16:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 13:42 [PATCH v2] iio: accel: Add driver for the MiraMEMS DA311 3-axis 12-bit digital accelerometer Hans de Goede
2016-09-22 17:10 ` Jonathan Cameron
2016-09-23 13:51 ` Hans de Goede
2016-09-24 16:46 ` Jonathan Cameron
2016-09-25 15:11 ` Lars-Peter Clausen
2016-09-25 16:44 ` 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=e8cdc33b-5331-7e25-8bdb-823cd462644f@kernel.org \
--to=jic23@kernel.org \
--cc=hdegoede@redhat.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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).