Re: [PATCH v10 4/6] iio: buffer-dma: Enable support for DMABUFs

From: Jonathan Cameron
Date: Sun Jun 09 2024 - 05:56:06 EST


On Wed, 5 Jun 2024 13:08:43 +0200
Paul Cercueil <paul@xxxxxxxxxxxxxxx> wrote:

> Implement iio_dma_buffer_attach_dmabuf(), iio_dma_buffer_detach_dmabuf()
> and iio_dma_buffer_transfer_dmabuf(), which can then be used by the IIO
> DMA buffer implementations.
>
> Signed-off-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx>
> Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx>
>
Same thing on SoB.
Also another missing structure field related docs comment inline.

> diff --git a/include/linux/iio/buffer-dma.h b/include/linux/iio/buffer-dma.h
> index 6e27e47077d5..e54158e53fd6 100644
> --- a/include/linux/iio/buffer-dma.h
> +++ b/include/linux/iio/buffer-dma.h
> @@ -7,6 +7,7 @@
> #ifndef __INDUSTRIALIO_DMA_BUFFER_H__
> #define __INDUSTRIALIO_DMA_BUFFER_H__
>
> +#include <linux/atomic.h>
> #include <linux/list.h>
> #include <linux/kref.h>
> #include <linux/spinlock.h>
> @@ -16,6 +17,9 @@
> struct iio_dma_buffer_queue;
> struct iio_dma_buffer_ops;
> struct device;
> +struct dma_buf_attachment;
> +struct dma_fence;
> +struct sg_table;
>
> /**
> * enum iio_block_state - State of a struct iio_dma_buffer_block
> @@ -41,6 +45,8 @@ enum iio_block_state {
> * @queue: Parent DMA buffer queue
> * @kref: kref used to manage the lifetime of block
> * @state: Current state of the block
> + * @cyclic: True if this is a cyclic buffer
> + * @fileio: True if this buffer is used for fileio mode

kernel doc needs to be complete. So missing attach, sg_table and fence.

> */
> struct iio_dma_buffer_block {
> /* May only be accessed by the owner of the block */
> @@ -63,6 +69,14 @@ struct iio_dma_buffer_block {
> * queue->list_lock if the block is not owned by the core.
> */
> enum iio_block_state state;
> +
> + bool cyclic;
> + bool fileio;
> +
> + struct dma_buf_attachment *attach;
> + struct sg_table *sg_table;
> +
> + struct dma_fence *fence;
> };