linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>, Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v3 01/12] iio:adc:ad799x: Fix reading and writing of event values, apply shift
Date: Sun, 29 Jun 2014 15:47:47 +0100	[thread overview]
Message-ID: <53B02713.1070702@kernel.org> (raw)
In-Reply-To: <539C5A0B.8030407@kernel.org>

On 14/06/14 15:19, Jonathan Cameron wrote:
> On 12/06/14 09:07, Lars-Peter Clausen wrote:
>> On 06/12/2014 06:54 AM, Peter Meerwald wrote:
>>> last two bits of ADC and limit values are zero and should not be reported
>>> (ad7993, ad7997); compare with read_raw()
>>>
>>> event values are 10 (ad7993, ad7997) or 12 bit max., check the range on write
>>>
>>> Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
>>
>> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
> Given I've been rather slow on pull requests yet, fixes-togreg has this file
> in the wrong place at the moment.  Hence I've applied this to
> fixes-togreg-post-3.16-rc1.
>
> I'll unwind this over the next day or so.
Oops, took me rather longer that that - sorry.

Anyhow, just sent pull request that includes this first patch so we
are underway!
>>
>> Thanks.
>>
>>> ---
>>>   drivers/iio/adc/ad799x.c | 8 ++++++--
>>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
>>> index 39b4cb4..6eba301 100644
>>> --- a/drivers/iio/adc/ad799x.c
>>> +++ b/drivers/iio/adc/ad799x.c
>>> @@ -427,9 +427,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev,
>>>       int ret;
>>>       struct ad799x_state *st = iio_priv(indio_dev);
>>>
>>> +    if (val < 0 || val > RES_MASK(chan->scan_type.realbits))
>>> +        return -EINVAL;
>>> +
>>>       mutex_lock(&indio_dev->mlock);
>>>       ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info),
>>> -        val);
>>> +        val << chan->scan_type.shift);
>>>       mutex_unlock(&indio_dev->mlock);
>>>
>>>       return ret;
>>> @@ -452,7 +455,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev,
>>>       mutex_unlock(&indio_dev->mlock);
>>>       if (ret < 0)
>>>           return ret;
>>> -    *val = valin;
>>> +    *val = (valin >> chan->scan_type.shift) &
>>> +        RES_MASK(chan->scan_type.realbits);
>>>
>>>       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
>
> --
> 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


  reply	other threads:[~2014-06-29 14:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12  4:54 [PATCH v3 00/12] ad799x cleanup Peter Meerwald
2014-06-12  4:54 ` [PATCH v3 01/12] iio:adc:ad799x: Fix reading and writing of event values, apply shift Peter Meerwald
2014-06-12  8:07   ` Lars-Peter Clausen
2014-06-14 14:19     ` Jonathan Cameron
2014-06-29 14:47       ` Jonathan Cameron [this message]
2014-06-12  4:54 ` [PATCH v3 02/12] iio:adc:ad799x: Fix ad799x_chip_info kerneldoc Peter Meerwald
2014-06-14 14:21   ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 03/12] iio:adc:ad799x: Drop I2C access helper functions Peter Meerwald
2014-06-12  8:10   ` Lars-Peter Clausen
2014-06-14 14:26     ` Jonathan Cameron
2014-07-13 20:47     ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 04/12] iio:adc:ad799x: Save some lines in ad7997_8_update_scan_mode() exit handling Peter Meerwald
2014-07-13 20:56   ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 05/12] iio:adc:ad799x: Use BIT() and GENMASK() Peter Meerwald
2014-07-13 20:56   ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 06/12] iio:adc:ad799x: Only expose event interface when IRQ is available Peter Meerwald
2014-07-13 20:56   ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 07/12] iio:adc:ad799x: Make chan_spec const in ad799x_chip_config struct Peter Meerwald
2014-07-13 20:57   ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 08/12] iio:adc:ad799x: Add helper function to read/write config register Peter Meerwald
2014-07-13 20:57   ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 09/12] iio:adc:ad799x: Write default config on probe and reset alert status on probe Peter Meerwald
2014-07-13 20:58   ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 10/12] iio:adc:ad799x: Set conversion channels and rename ad7997_8_update_scan_mode() Peter Meerwald
2014-07-13 20:58   ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 11/12] iio:adc:ad799x: Return more meaningful event enabled state Peter Meerwald
2014-06-12  8:08   ` Lars-Peter Clausen
2014-07-13 20:59     ` Jonathan Cameron
2014-06-12  4:54 ` [PATCH v3 12/12] iio:adc:ad799x: Allow to write event config Peter Meerwald
2014-06-12  8:08   ` Lars-Peter Clausen
2014-07-13 21:01     ` 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=53B02713.1070702@kernel.org \
    --to=jic23@kernel.org \
    --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).