[PATCH 3/7] iio: buffer: document iio_push_to_buffers_with_ts()

David Lechner posted 7 patches 2 weeks, 6 days ago
There is a newer version of this series
[PATCH 3/7] iio: buffer: document iio_push_to_buffers_with_ts()
Posted by David Lechner 2 weeks, 6 days ago
Document the iio_push_to_buffers_with_ts() function.

This is copied and slightly cleaned up from
iio_push_to_buffers_with_timestamp().

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 include/linux/iio/buffer.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 5c84ec4a981001dfba3b369f811368bab70a3117..47f23bc0470eaf308fc3a739faaf9b56cac0ef67 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -45,6 +45,22 @@ static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
 	return iio_push_to_buffers(indio_dev, data);
 }
 
+/**
+ * iio_push_to_buffers_with_ts() - push data and timestamp to buffers
+ * @indio_dev:		iio_dev structure for device.
+ * @data:		Pointer to sample data buffer.
+ * @data_total_len:	The size of @data in bytes.
+ * @timestamp:		Timestamp for the sample data.
+ *
+ * Pushes data to the IIO device's buffers. If timestamps are enabled for the
+ * device the function will store the supplied timestamp as the last element in
+ * the sample data buffer before pushing it to the device buffers. The sample
+ * data buffer needs to be large enough to hold the additional timestamp
+ * (usually the buffer should be indio->scan_bytes bytes large).
+ *
+ * Context: Any context.
+ * Return: 0 on success, a negative error code otherwise.
+ */
 static inline int iio_push_to_buffers_with_ts(struct iio_dev *indio_dev,
 					      void *data, size_t data_total_len,
 					      s64 timestamp)

-- 
2.43.0
Re: [PATCH 3/7] iio: buffer: document iio_push_to_buffers_with_ts()
Posted by Jonathan Cameron 2 weeks, 5 days ago
On Fri, 12 Sep 2025 11:05:54 -0500
David Lechner <dlechner@baylibre.com> wrote:

> Document the iio_push_to_buffers_with_ts() function.
> 
> This is copied and slightly cleaned up from
> iio_push_to_buffers_with_timestamp().
> 
> Signed-off-by: David Lechner <dlechner@baylibre.com>
> ---
>  include/linux/iio/buffer.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
> index 5c84ec4a981001dfba3b369f811368bab70a3117..47f23bc0470eaf308fc3a739faaf9b56cac0ef67 100644
> --- a/include/linux/iio/buffer.h
> +++ b/include/linux/iio/buffer.h
> @@ -45,6 +45,22 @@ static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
>  	return iio_push_to_buffers(indio_dev, data);
>  }
>  
> +/**
> + * iio_push_to_buffers_with_ts() - push data and timestamp to buffers
> + * @indio_dev:		iio_dev structure for device.
> + * @data:		Pointer to sample data buffer.
> + * @data_total_len:	The size of @data in bytes.
> + * @timestamp:		Timestamp for the sample data.
> + *
> + * Pushes data to the IIO device's buffers. If timestamps are enabled for the
> + * device the function will store the supplied timestamp as the last element in
> + * the sample data buffer before pushing it to the device buffers. The sample
> + * data buffer needs to be large enough to hold the additional timestamp
> + * (usually the buffer should be indio->scan_bytes bytes large).
usually the buffer should be at least indio->scan_bytes bytes large)

It is really common for it to be bigger and don't want people thinking the
need to dynamically resize it!

> + *
> + * Context: Any context.
> + * Return: 0 on success, a negative error code otherwise.
> + */
>  static inline int iio_push_to_buffers_with_ts(struct iio_dev *indio_dev,
>  					      void *data, size_t data_total_len,
>  					      s64 timestamp)
>