drm/tegra: gem: Use dma_get_sgtable()
authorThierry Reding <treding@nvidia.com>
Fri, 8 Jun 2018 12:56:04 +0000 (14:56 +0200)
committerThierry Reding <treding@nvidia.com>
Mon, 28 Oct 2019 10:18:39 +0000 (11:18 +0100)
Rather than manually creating an SG table in an incorrect way, let the
standard dma_get_sgtable() function do it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/gem.c

index 7412e23..3345cce 100644 (file)
@@ -520,11 +520,9 @@ tegra_gem_prime_map_dma_buf(struct dma_buf_attachment *attach,
                if (dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir) == 0)
                        goto free;
        } else {
-               if (sg_alloc_table(sgt, 1, GFP_KERNEL))
+               if (dma_get_sgtable(attach->dev, sgt, bo->vaddr, bo->iova,
+                                   gem->size) < 0)
                        goto free;
-
-               sg_dma_address(sgt->sgl) = bo->iova;
-               sg_dma_len(sgt->sgl) = gem->size;
        }
 
        return sgt;