Re: [PATCH] iio: buffer: use dma_buf_unmap_attachment_unlocked() helper

From: Jonathan Cameron

Date: Sat Nov 15 2025 - 12:31:52 EST


On Fri, 14 Nov 2025 09:07:33 +0000
Nuno Sá <noname.nuno@xxxxxxxxx> wrote:

> On Fri, 2025-11-14 at 16:47 +0800, Liang Jie wrote:
> > From: Liang Jie <liangjie@xxxxxxxxxxx>
> >
> > Replace open-coded dma_resv_lock()/dma_resv_unlock() around
> > dma_buf_unmap_attachment() in iio_buffer_dmabuf_release() with the
> > dma_buf_unmap_attachment_unlocked() helper.
> >
> > This aligns with the standard DMA-BUF API, avoids duplicating
> > locking logic and eases future maintenance. No functional change.
> >
> > Reviewed-by: fanggeng <fanggeng@xxxxxxxxxxx>
> > Signed-off-by: Liang Jie <liangjie@xxxxxxxxxxx>
> > ---
>
> Reviewed-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
Applied.

Thanks,

Jonathan

>
> >  drivers/iio/industrialio-buffer.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> > index a80f7cc25a27..58330abbf40a 100644
> > --- a/drivers/iio/industrialio-buffer.c
> > +++ b/drivers/iio/industrialio-buffer.c
> > @@ -1563,9 +1563,7 @@ static void iio_buffer_dmabuf_release(struct kref *ref)
> >   struct iio_buffer *buffer = priv->buffer;
> >   struct dma_buf *dmabuf = attach->dmabuf;
> >  
> > - dma_resv_lock(dmabuf->resv, NULL);
> > - dma_buf_unmap_attachment(attach, priv->sgt, priv->dir);
> > - dma_resv_unlock(dmabuf->resv);
> > + dma_buf_unmap_attachment_unlocked(attach, priv->sgt, priv->dir);
> >  
> >   buffer->access->detach_dmabuf(buffer, priv->block);
> >