This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: videobuf2-dma-sg: fix vmap callback
Author:  Michael Grzeschik <m.grzesc...@pengutronix.de>
Date:    Thu Nov 23 23:32:05 2023 +0100

For dmabuf import users to be able to use the vaddr from another
videobuf2-dma-sg source, the exporter needs to set a proper vaddr on
vb2_dma_sg_dmabuf_ops_vmap callback. This patch adds vmap on map if
buf->vaddr was not set.

Cc: sta...@kernel.org
Fixes: 7938f4218168 ("dma-buf-map: Rename to iosys-map")
Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de>
Acked-by: Tomasz Figa <tf...@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 drivers/media/common/videobuf2/videobuf2-dma-sg.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

---

diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c 
b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
index 28f3fdfe23a2..6975a71d740f 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
@@ -487,9 +487,15 @@ vb2_dma_sg_dmabuf_ops_end_cpu_access(struct dma_buf *dbuf,
 static int vb2_dma_sg_dmabuf_ops_vmap(struct dma_buf *dbuf,
                                      struct iosys_map *map)
 {
-       struct vb2_dma_sg_buf *buf = dbuf->priv;
+       struct vb2_dma_sg_buf *buf;
+       void *vaddr;
+
+       buf = dbuf->priv;
+       vaddr = vb2_dma_sg_vaddr(buf->vb, buf);
+       if (!vaddr)
+               return -EINVAL;
 
-       iosys_map_set_vaddr(map, buf->vaddr);
+       iosys_map_set_vaddr(map, vaddr);
 
        return 0;
 }

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to