iio:ad7887: Use iio_push_to_buffers_with_timestamp()
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 19 Sep 2013 12:59:00 +0000 (13:59 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 21 Sep 2013 18:23:53 +0000 (19:23 +0100)
Makes the code a bit shorter and less ugly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/ad7887.c

index 9dd077b78759047ae39fde5a8d0a2b589b487b22..faedd0e165f6e85dbf495b4a32b232d3f26ab907 100644 (file)
@@ -121,20 +121,14 @@ static irqreturn_t ad7887_trigger_handler(int irq, void *p)
        struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct ad7887_state *st = iio_priv(indio_dev);
-       s64 time_ns;
        int b_sent;
 
        b_sent = spi_sync(st->spi, st->ring_msg);
        if (b_sent)
                goto done;
 
-       time_ns = iio_get_time_ns();
-
-       if (indio_dev->scan_timestamp)
-               memcpy(st->data + indio_dev->scan_bytes - sizeof(s64),
-                      &time_ns, sizeof(time_ns));
-
-       iio_push_to_buffers(indio_dev, st->data);
+       iio_push_to_buffers_with_timestamp(indio_dev, st->data,
+               iio_get_time_ns());
 done:
        iio_trigger_notify_done(indio_dev->trig);