diff mbox series

[RFC,1/8] iio: buffer: add function to set the buffer direction

Message ID 20240216-iio-backend-axi-dds-v1-1-22aed9fb07a1@analog.com (mailing list archive)
State Changes Requested
Headers show
Series iio: dac: support IIO backends on the output direction | expand

Commit Message

Nuno Sa via B4 Relay Feb. 16, 2024, 2:10 p.m. UTC
From: Nuno Sa <nuno.sa@analog.com>

Add an helper function to set the direction. This is preliminary change
and will be useful for IIO backends that provide output buffers.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
 drivers/iio/industrialio-buffer.c | 12 ++++++++++++
 include/linux/iio/buffer.h        |  3 +++
 2 files changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index b581a7e80566..504e5a96bd90 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -1982,6 +1982,18 @@  void iio_buffer_put(struct iio_buffer *buffer)
 }
 EXPORT_SYMBOL_GPL(iio_buffer_put);
 
+/**
+ * iio_buffer_set_dir() - Set the buffer direction
+ * @buffer: The buffer to set the direction
+ * @direction: The direction
+ */
+void iio_buffer_set_dir(struct iio_buffer *buffer,
+			enum iio_buffer_direction direction)
+{
+	buffer->direction = direction;
+}
+EXPORT_SYMBOL(iio_buffer_set_dir);
+
 /**
  * iio_device_attach_buffer - Attach a buffer to a IIO device
  * @indio_dev: The device the buffer should be attached to
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 418b1307d3f2..aee52b834443 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -55,4 +55,7 @@  bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
 int iio_device_attach_buffer(struct iio_dev *indio_dev,
 			     struct iio_buffer *buffer);
 
+void iio_buffer_set_dir(struct iio_buffer *buffer,
+			enum iio_buffer_direction direction);
+
 #endif /* _IIO_BUFFER_GENERIC_H_ */