From: Jonathan Cameron <jic23@kernel.org>
To: "Stefan Brüns" <stefan.bruens@rwth-aachen.de>
Cc: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: Re: [PATCH] iio: adc: ina219: Avoid underflow for sleeping time
Date: Sun, 30 Jul 2017 14:50:59 +0100 [thread overview]
Message-ID: <20170730145059.5975d2fa@kernel.org> (raw)
In-Reply-To: <ad692a867c25499ea8e0859f72f46549@rwthex-w2-b.rwth-ad.de>
On Wed, 26 Jul 2017 23:32:06 +0200
Stefan Brüns <stefan.bruens@rwth-aachen.de> wrote:
> Proper support for the INA219 lowered the minimum sampling period from
> 2*140us to 2*84us. Subtracting 200us later leads to an underflow and
> an almost infinite udelay later.
>
> Using a signed int for the sampling period provides sufficient range
> (at most 2*8640*1024us), but catches the underflow when comparing with
> buffer_us.
>
> Fixes: 18edac2e22f4 ("iio: adc: Fix integration time/averaging for INA219/220")
> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
applied to the fixes-togreg branch of iio.git
Thanks,
Jonathan
> ---
> drivers/iio/adc/ina2xx-adc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c
> index b0d9e3b80e6d..85b419ea9ba9 100644
> --- a/drivers/iio/adc/ina2xx-adc.c
> +++ b/drivers/iio/adc/ina2xx-adc.c
> @@ -657,7 +657,7 @@ static int ina2xx_capture_thread(void *data)
> {
> struct iio_dev *indio_dev = data;
> struct ina2xx_chip_info *chip = iio_priv(indio_dev);
> - unsigned int sampling_us = SAMPLING_PERIOD(chip);
> + int sampling_us = SAMPLING_PERIOD(chip);
> int buffer_us;
>
> /*
prev parent reply other threads:[~2017-07-30 13:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 21:32 [PATCH] iio: adc: ina219: Avoid underflow for sleeping time Stefan Brüns
2017-07-30 13:50 ` 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=20170730145059.5975d2fa@kernel.org \
--to=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=stefan.bruens@rwth-aachen.de \
/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.