提交 ff3aa88a 编写于 作者: S Stefan Brüns 提交者: Jonathan Cameron

iio: adc: ina219: Avoid underflow for sleeping time

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: 18edac2e ("iio: adc: Fix integration time/averaging for INA219/220")
Signed-off-by: NStefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: NJonathan Cameron <Jonathan.Cameron@huawei.com>
上级 90938ca4
...@@ -644,7 +644,7 @@ static int ina2xx_capture_thread(void *data) ...@@ -644,7 +644,7 @@ static int ina2xx_capture_thread(void *data)
{ {
struct iio_dev *indio_dev = data; struct iio_dev *indio_dev = data;
struct ina2xx_chip_info *chip = iio_priv(indio_dev); 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; int buffer_us;
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册