diff mbox series

[1/2] drm/i915/dmabuf: Update dma_buf_ops.unmap_dma_buf callback to use drm_gem_unmap_dma_buf()

Message ID 20220225131316.1433515-2-gwan-gyeong.mun@intel.com (mailing list archive)
State New, archived
Headers show
Series Fix prime_mmap to work when using LMEM | expand

Commit Message

Gwan-gyeong Mun Feb. 25, 2022, 1:13 p.m. UTC
The dma_buf_ops.unmap_dma_buf callback used in i915,
i915_gem_unmap_dma_buf(), has the same code as drm_gem_unmap_dma_buf().
In order to eliminate defining and using duplicate function, it updates
the dma_buf_ops.unmap_dma_buf callback to use drm_gem_unmap_dma_buf().

Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Comments

Nirmoy Das Feb. 28, 2022, 3:23 p.m. UTC | #1
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>

On 25/02/2022 14:13, Gwan-gyeong Mun wrote:
> The dma_buf_ops.unmap_dma_buf callback used in i915,
> i915_gem_unmap_dma_buf(), has the same code as drm_gem_unmap_dma_buf().
> In order to eliminate defining and using duplicate function, it updates
> the dma_buf_ops.unmap_dma_buf callback to use drm_gem_unmap_dma_buf().
>
> Signed-off-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
> ---
>   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 11 +----------
>   1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> index 13917231ae81..af899ae1f3c7 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
> @@ -66,15 +66,6 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme
>   	return ERR_PTR(ret);
>   }
>   
> -static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
> -				   struct sg_table *sg,
> -				   enum dma_data_direction dir)
> -{
> -	dma_unmap_sgtable(attachment->dev, sg, dir, DMA_ATTR_SKIP_CPU_SYNC);
> -	sg_free_table(sg);
> -	kfree(sg);
> -}
> -
>   static int i915_gem_dmabuf_vmap(struct dma_buf *dma_buf,
>   				struct iosys_map *map)
>   {
> @@ -209,7 +200,7 @@ static const struct dma_buf_ops i915_dmabuf_ops =  {
>   	.attach = i915_gem_dmabuf_attach,
>   	.detach = i915_gem_dmabuf_detach,
>   	.map_dma_buf = i915_gem_map_dma_buf,
> -	.unmap_dma_buf = i915_gem_unmap_dma_buf,
> +	.unmap_dma_buf = drm_gem_unmap_dma_buf,
>   	.release = drm_gem_dmabuf_release,
>   	.mmap = i915_gem_dmabuf_mmap,
>   	.vmap = i915_gem_dmabuf_vmap,
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
index 13917231ae81..af899ae1f3c7 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
@@ -66,15 +66,6 @@  static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme
 	return ERR_PTR(ret);
 }
 
-static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
-				   struct sg_table *sg,
-				   enum dma_data_direction dir)
-{
-	dma_unmap_sgtable(attachment->dev, sg, dir, DMA_ATTR_SKIP_CPU_SYNC);
-	sg_free_table(sg);
-	kfree(sg);
-}
-
 static int i915_gem_dmabuf_vmap(struct dma_buf *dma_buf,
 				struct iosys_map *map)
 {
@@ -209,7 +200,7 @@  static const struct dma_buf_ops i915_dmabuf_ops =  {
 	.attach = i915_gem_dmabuf_attach,
 	.detach = i915_gem_dmabuf_detach,
 	.map_dma_buf = i915_gem_map_dma_buf,
-	.unmap_dma_buf = i915_gem_unmap_dma_buf,
+	.unmap_dma_buf = drm_gem_unmap_dma_buf,
 	.release = drm_gem_dmabuf_release,
 	.mmap = i915_gem_dmabuf_mmap,
 	.vmap = i915_gem_dmabuf_vmap,