Re: [PATCH v2 6/9] iio: buffer-dmaengine: Use dma_slave_caps bus width accessors

Jonathan Cameron <[email protected]>
Newsgroups org.kernel.vger.dmaengine,org.kernel.vger.linux-iio
Message-ID <20260812054827.7d97a564@jic23-huawei>
On Mon, 10 Aug 2026 16:06:47 +0100
Nuno Sá <[email protected]> wrote:

> Query the minimum supported source and destination bus widths through
> the new dma_slave_caps_get_{src,dst}_width_min() helpers rather than
> decoding the raw legacy u32 width masks. This keeps the buffer working
> with DMA controllers that advertise bus widths via the new bitmap
> representation.
> 
> Reviewed-by: Frank Li <[email protected]>
> Signed-off-by: Nuno Sá <[email protected]>
I'm currently assuming this will all go through a single tree
(and not mine) As such

Acked-by: Jonathan Cameron <[email protected]>

> ---
>  drivers/iio/buffer/industrialio-buffer-dmaengine.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> index 98acce909854..855e3662cd3d 100644
> --- a/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> +++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> @@ -229,14 +229,13 @@ static struct iio_buffer *iio_dmaengine_buffer_alloc(struct dma_chan *chan)
>  		return ERR_PTR(-ENOMEM);
>  
>  	/* Needs to be aligned to the maximum of the minimums */
> -	if (caps.src_addr_widths)
> -		src_width = __ffs(caps.src_addr_widths);
> -	else
> -		src_width = 1;
> -	if (caps.dst_addr_widths)
> -		dest_width = __ffs(caps.dst_addr_widths);
> -	else
> -		dest_width = 1;
> +	src_width = dma_slave_caps_get_src_width_min(&caps);
> +	if (src_width == DMA_SLAVE_BUSWIDTH_UNDEFINED)
> +		src_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
> +	dest_width = dma_slave_caps_get_dst_width_min(&caps);
> +	if (dest_width == DMA_SLAVE_BUSWIDTH_UNDEFINED)
> +		dest_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
> +
>  	width = max(src_width, dest_width);
>  
>  	INIT_LIST_HEAD(&dmaengine_buffer->active);
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.