iio: Add iio_push_buffers_with_timestamp() helper
iio: Add iio_push_buffers_with_timestamp() helper

Drivers using software buffers often store the timestamp in their data buffer
before calling iio_push_to_buffers() with that data buffer. Storing the
timestamp in the buffer usually involves some ugly pointer arithmetic. This
patch adds a new helper function called iio_push_buffers_with_timestamp() which
is similar to iio_push_to_buffers but takes an additional timestamp parameter.
The function will help to hide to uglyness in one central place instead of
exposing it in every driver. If timestamps are enabled for the IIO device
iio_push_buffers_with_timestamp() will store the timestamp as the last element
in buffer, before passing the buffer on to iio_push_buffers(). The buffer needs
large enough to hold the timestamp in this case. If timestamps are disabled
iio_push_buffers_with_timestamp() will behave just like iio_push_buffers().

Signed-off-by: Lars-Peter Clausen <3318dc5ce3e4fb7c28a0b841b6801c884e1d0896@metafoo.de>
Cc: Oleksandr Kravchenko <4e5f2b6ab793baf802fe9cd39d665426e95bd946@globallogic.com>
Cc: Josh Wu <5d315a13f7549d1ecf8e62305448b567ef831df9@atmel.com>
Cc: Denis Ciocca <4a3a1b0e59e4bf62df5d92c6ace86f220d56cdac@gmail.com>
Cc: Manuel Stahl <e8567e680e7eb2b45251ced5bfa958f0e08b7c96@iis.fraunhofer.de>
Cc: Ge Gao <b3424968d47356948555a8fa6738d79f0cbd67d9@invensense.com>
Cc: Peter Meerwald <a2c19d57d338d8f9d8de092166164455662a8cbe@pmeerw.net>
Cc: Jacek Anaszewski <6a953cb1c532e2765a42e582ecefff5a01106214@samsung.com>
Cc: Fabio Estevam <679188261afeb60eb822cd934fd7b46a48ddd743@freescale.com>
Cc: Marek Vasut <f40600653b33f5282fa4c5daf377dfc444fb4625@denx.de>
Signed-off-by: Jonathan Cameron <09f65b71b7655725897b2fd41a09a0cefe2e1ace@kernel.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs