xen/gntdev: Prepare to dynamic dma-buf locking specification
authorDmitry Osipenko <dmitry.osipenko@collabora.com>
Mon, 17 Oct 2022 17:22:20 +0000 (20:22 +0300)
committerDmitry Osipenko <dmitry.osipenko@collabora.com>
Mon, 17 Oct 2022 22:21:47 +0000 (01:21 +0300)
Prepare gntdev driver to the common dynamic dma-buf locking convention
by starting to use the unlocked versions of dma-buf API functions.

Acked-by: Juergen Gross <jgross@suse.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221017172229.42269-13-dmitry.osipenko@collabora.com
drivers/xen/gntdev-dmabuf.c

index 940e5e9e8a54a7391de26509348b95aadf8b1f27..4440e626b7975fc2ea000b159179be0173d84c72 100644 (file)
@@ -600,7 +600,7 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev,
 
        gntdev_dmabuf->u.imp.attach = attach;
 
-       sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL);
+       sgt = dma_buf_map_attachment_unlocked(attach, DMA_BIDIRECTIONAL);
        if (IS_ERR(sgt)) {
                ret = ERR_CAST(sgt);
                goto fail_detach;
@@ -658,7 +658,7 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, struct device *dev,
 fail_end_access:
        dmabuf_imp_end_foreign_access(gntdev_dmabuf->u.imp.refs, count);
 fail_unmap:
-       dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL);
+       dma_buf_unmap_attachment_unlocked(attach, sgt, DMA_BIDIRECTIONAL);
 fail_detach:
        dma_buf_detach(dma_buf, attach);
 fail_free_obj:
@@ -708,8 +708,8 @@ static int dmabuf_imp_release(struct gntdev_dmabuf_priv *priv, u32 fd)
        attach = gntdev_dmabuf->u.imp.attach;
 
        if (gntdev_dmabuf->u.imp.sgt)
-               dma_buf_unmap_attachment(attach, gntdev_dmabuf->u.imp.sgt,
-                                        DMA_BIDIRECTIONAL);
+               dma_buf_unmap_attachment_unlocked(attach, gntdev_dmabuf->u.imp.sgt,
+                                                 DMA_BIDIRECTIONAL);
        dma_buf = attach->dmabuf;
        dma_buf_detach(attach->dmabuf, attach);
        dma_buf_put(dma_buf);