]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iio: st_sensors: use the helper function
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 1 Sep 2016 08:27:18 +0000 (10:27 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sat, 10 Sep 2016 15:49:25 +0000 (16:49 +0100)
The ST sensors can be used as a trigger for its own triggered buffer
but it is also possible to use an external trigger: a HRTimer or
even a different sensor (!) as trigger. In that case we should not
pick the timestamp from our own interrupt top half even if it is
active.

This could practically happen if some other sensor is using the
ST sensor as trigger but the ST sensor itself is using e.g.
an HRTimer as trigger. So the trigger is on, but not used by us.

We used to assume that whenever the hardware interrupt is turned
on, we are using it for our own trigger, but this is an
oversimplification.

Handle this logically by using the iio_trigger_using_own() helper.

Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Cc: Crestez Dan Leonard <leonard.crestez@intel.com>
Cc: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/common/st_sensors/st_sensors_buffer.c

index d06e728cea370172b4aa26829f9be5892cad747b..fe7775bb37402ea73915189d2c4f121b0a74464d 100644 (file)
@@ -63,7 +63,7 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p)
         * 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)
+       if (iio_trigger_using_own(indio_dev))
                timestamp = sdata->hw_timestamp;
        else
                timestamp = iio_get_time_ns(indio_dev);