summaryrefslogtreecommitdiffstats
path: root/drivers/iio/common/st_sensors/st_sensors_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/common/st_sensors/st_sensors_buffer.c')
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_buffer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c
index 7c84e90..2371fc8 100644
--- a/drivers/iio/common/st_sensors/st_sensors_buffer.c
+++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c
@@ -58,7 +58,12 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p)
struct st_sensor_data *sdata = iio_priv(indio_dev);
s64 timestamp;
- /* If we do timetamping here, do it before reading the values */
+ /*
+ * If we do timetamping here, do it before reading the values, because
+ * once we've read the values, new interrupts can occur (when using
+ * the hardware trigger) and the hw_timestamp may get updated.
+ * By storing it in a local variable first, we are safe.
+ */
if (sdata->hw_irq_trigger)
timestamp = sdata->hw_timestamp;
else
OpenPOWER on IntegriCloud