From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@cam.ac.uk>, linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/7] staging:iio:adis16080: Perform sign extension
Date: Sat, 26 Jan 2013 10:32:52 +0000 [thread overview]
Message-ID: <5103B0D4.6020802@kernel.org> (raw)
In-Reply-To: <50EDDE25.4040101@kernel.org>
On 01/09/2013 09:16 PM, Jonathan Cameron wrote:
> On 01/09/2013 08:34 PM, Lars-Peter Clausen wrote:
>> On 01/09/2013 09:09 PM, Jonathan Cameron wrote:
>>> On 01/09/2013 02:01 PM, Lars-Peter Clausen wrote:
>>>> The adis16080 reports sample values in twos complement. So we need to perform a
>>>> sign extension on the result, otherwise negative values will be reported
>>>> incorrectly as large positive values.
>>>>
>>>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>>> Added to fixes-togreg branch of iio.git
All now applied was a little fiddly as somehow the small change
here propogated to the context of about half the remaining patches.
Result all looks fine though...
>>>>
>>>> ---
>>>> This one should go into 3.8 if possible, the rest of the series is for 3.9
>>>> ---
>>>> drivers/staging/iio/gyro/adis16080_core.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c
>>>> index 3525a68..149ff99 100644
>>>> --- a/drivers/staging/iio/gyro/adis16080_core.c
>>>> +++ b/drivers/staging/iio/gyro/adis16080_core.c
>>>> @@ -69,7 +69,7 @@ static int adis16080_spi_read(struct iio_dev *indio_dev,
>>>> ret = spi_read(st->us, st->buf, 2);
>>>>
>>>> if (ret == 0)
>>>> - *val = ((st->buf[0] & 0xF) << 8) | st->buf[1];
>>>> + *val = sign_extend32(12, ((st->buf[0] & 0xF) << 8) | st->buf[1]);
>>>> mutex_unlock(&st->buf_lock);
>>>>
>>
>> Sorry, now that I look at it from a distance: This is completely wrong...
>> It needs to be,
>>
>> sign_extend32((st->buf[0] & 0xF) << 8) | st->buf[1], 11);
>>
>> Sorry again,
>> - Lars
>>
> Fixed up.
>
> Hadn't pushed out yet anyway so only messing in my local tree.
> --
> 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:[~2013-01-26 10:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 14:01 [PATCH 1/7] staging:iio:adis16080: Perform sign extension Lars-Peter Clausen
2013-01-09 14:01 ` [PATCH 2/7] staging:iio:adis16080: Add device id table entry for the adis16100 Lars-Peter Clausen
2013-01-09 21:44 ` Jonathan Cameron
2013-01-09 14:01 ` [PATCH 3/7] staging:iio:adis16080: Cleanup SPI transfer Lars-Peter Clausen
2013-01-09 21:45 ` Jonathan Cameron
2013-01-09 14:01 ` [PATCH 4/7] staging:iio:adis16080: be16 cleanups Lars-Peter Clausen
2013-01-09 21:49 ` Jonathan Cameron
2013-01-09 14:01 ` [PATCH 5/7] staging:iio:adis16080: Remove unnecessary lock Lars-Peter Clausen
2013-01-09 14:01 ` [PATCH 6/7] staging:iio:adis16080: Add scale and offset attributes Lars-Peter Clausen
2013-01-09 14:01 ` [PATCH 7/7] staging:iio:adis16080: Move out of staging Lars-Peter Clausen
2013-01-09 20:09 ` [PATCH 1/7] staging:iio:adis16080: Perform sign extension Jonathan Cameron
2013-01-09 20:34 ` Lars-Peter Clausen
2013-01-09 21:16 ` Jonathan Cameron
2013-01-26 10:32 ` 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=5103B0D4.6020802@kernel.org \
--to=jic23@kernel.org \
--cc=jic23@cam.ac.uk \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.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).