Browse Source

iio: adc: ina2xx: Align timestamp with conversion ready flag

As the timestamp is no longer (ab-)used to measure the function run time,
it can be taken at the correct time, i.e. when the conversion has finished.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stefan Brüns 7 years ago
parent
commit
8c3a7b0a6c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      drivers/iio/adc/ina2xx-adc.c

+ 2 - 2
drivers/iio/adc/ina2xx-adc.c

@@ -708,8 +708,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
 	s64 time;
 	s64 time;
 	unsigned int alert;
 	unsigned int alert;
 
 
-	time = iio_get_time_ns(indio_dev);
-
 	/*
 	/*
 	 * Because the timer thread and the chip conversion clock
 	 * Because the timer thread and the chip conversion clock
 	 * are asynchronous, the period difference will eventually
 	 * are asynchronous, the period difference will eventually
@@ -738,6 +736,8 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev)
 
 
 		} while (!alert);
 		} while (!alert);
 
 
+	time = iio_get_time_ns(indio_dev);
+
 	/*
 	/*
 	 * Single register reads: bulk_read will not work with ina226/219
 	 * Single register reads: bulk_read will not work with ina226/219
 	 * as there is no auto-increment of the register pointer.
 	 * as there is no auto-increment of the register pointer.