Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio:ad7923: Use iio_push_to_buffers_with_timestamp()

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>

authored by

Lars-Peter Clausen and committed by
Jonathan Cameron
9f4fa4f7 5afd602b

+2 -8
+2 -8
drivers/iio/adc/ad7923.c
··· 174 174 struct iio_poll_func *pf = p; 175 175 struct iio_dev *indio_dev = pf->indio_dev; 176 176 struct ad7923_state *st = iio_priv(indio_dev); 177 - s64 time_ns = 0; 178 177 int b_sent; 179 178 180 179 b_sent = spi_sync(st->spi, &st->ring_msg); 181 180 if (b_sent) 182 181 goto done; 183 182 184 - if (indio_dev->scan_timestamp) { 185 - time_ns = iio_get_time_ns(); 186 - memcpy((u8 *)st->rx_buf + indio_dev->scan_bytes - sizeof(s64), 187 - &time_ns, sizeof(time_ns)); 188 - } 189 - 190 - iio_push_to_buffers(indio_dev, st->rx_buf); 183 + iio_push_to_buffers_with_timestamp(indio_dev, st->rx_buf, 184 + iio_get_time_ns()); 191 185 192 186 done: 193 187 iio_trigger_notify_done(indio_dev->trig);