Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: buffer: use dma_buf_unmap_attachment_unlocked() helper
@ 2025-11-14  8:47 Liang Jie
  2025-11-14  9:07 ` Nuno Sá
  0 siblings, 1 reply; 3+ messages in thread
From: Liang Jie @ 2025-11-14  8:47 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	open list:IIO SUBSYSTEM AND DRIVERS, open list
  Cc: liangjie, fanggeng, yangchen11

From: Liang Jie <liangjie@lixiang.com>

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@lixiang.com>
Signed-off-by: Liang Jie <liangjie@lixiang.com>
---
 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);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: buffer: use dma_buf_unmap_attachment_unlocked() helper
  2025-11-14  8:47 [PATCH] iio: buffer: use dma_buf_unmap_attachment_unlocked() helper Liang Jie
@ 2025-11-14  9:07 ` Nuno Sá
  2025-11-15 17:31   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Nuno Sá @ 2025-11-14  9:07 UTC (permalink / raw)
  To: Liang Jie, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, open list:IIO SUBSYSTEM AND DRIVERS, open list
  Cc: liangjie, fanggeng, yangchen11

On Fri, 2025-11-14 at 16:47 +0800, Liang Jie wrote:
> From: Liang Jie <liangjie@lixiang.com>
> 
> 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@lixiang.com>
> Signed-off-by: Liang Jie <liangjie@lixiang.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  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);
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: buffer: use dma_buf_unmap_attachment_unlocked() helper
  2025-11-14  9:07 ` Nuno Sá
@ 2025-11-15 17:31   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-11-15 17:31 UTC (permalink / raw)
  To: Nuno Sá
  Cc: Liang Jie, David Lechner, Nuno Sá, Andy Shevchenko,
	open list:IIO SUBSYSTEM AND DRIVERS, open list, liangjie,
	fanggeng, yangchen11

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

> On Fri, 2025-11-14 at 16:47 +0800, Liang Jie wrote:
> > From: Liang Jie <liangjie@lixiang.com>
> > 
> > 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@lixiang.com>
> > Signed-off-by: Liang Jie <liangjie@lixiang.com>
> > ---  
> 
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
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);
> >    


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-15 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-14  8:47 [PATCH] iio: buffer: use dma_buf_unmap_attachment_unlocked() helper Liang Jie
2025-11-14  9:07 ` Nuno Sá
2025-11-15 17:31   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox