@@ -1535,6 +1535,11 @@ static int iio_buffer_enqueue_dmabuf(struct iio_buffer *buffer,
if (dmabuf.flags & ~IIO_BUFFER_DMABUF_SUPPORTED_FLAGS)
return -EINVAL;
+ /* Cyclic flag is only supported on output buffers */
+ if ((dmabuf.flags & IIO_BUFFER_DMABUF_CYCLIC) &&
+ buffer->direction != IIO_BUFFER_DIRECTION_OUT)
+ return -EINVAL;
+
return buffer->access->enqueue_dmabuf(buffer, &dmabuf);
}
@@ -7,7 +7,8 @@
#include <linux/types.h>
-#define IIO_BUFFER_DMABUF_SUPPORTED_FLAGS 0x00000000
+#define IIO_BUFFER_DMABUF_CYCLIC (1 << 0)
+#define IIO_BUFFER_DMABUF_SUPPORTED_FLAGS 0x00000001
/**
* struct iio_dmabuf_alloc_req - Descriptor for allocating IIO DMABUFs