drm/tegra: gem: Use iommu_map_sg()
authorThierry Reding <treding@nvidia.com>
Wed, 17 Dec 2014 15:46:37 +0000 (16:46 +0100)
committerThierry Reding <treding@nvidia.com>
Tue, 27 Jan 2015 09:14:34 +0000 (10:14 +0100)
The iommu_map_sg() function is now available in the IOMMU API, so drop
the open-coded variant.

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

index 8777b7f..1ccde09 100644 (file)
@@ -92,36 +92,6 @@ static const struct host1x_bo_ops tegra_bo_ops = {
        .kunmap = tegra_bo_kunmap,
 };
 
-/*
- * A generic iommu_map_sg() function is being reviewed and will hopefully be
- * merged soon. At that point this function can be dropped in favour of the
- * one provided by the IOMMU API.
- */
-static ssize_t __iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
-                             struct scatterlist *sg, unsigned int nents,
-                             int prot)
-{
-       struct scatterlist *s;
-       size_t offset = 0;
-       unsigned int i;
-       int err;
-
-       for_each_sg(sg, s, nents, i) {
-               phys_addr_t phys = page_to_phys(sg_page(s));
-               size_t length = s->offset + s->length;
-
-               err = iommu_map(domain, iova + offset, phys, length, prot);
-               if (err < 0) {
-                       iommu_unmap(domain, iova, offset);
-                       return err;
-               }
-
-               offset += length;
-       }
-
-       return offset;
-}
-
 static int tegra_bo_iommu_map(struct tegra_drm *tegra, struct tegra_bo *bo)
 {
        int prot = IOMMU_READ | IOMMU_WRITE;
@@ -144,8 +114,8 @@ static int tegra_bo_iommu_map(struct tegra_drm *tegra, struct tegra_bo *bo)
 
        bo->paddr = bo->mm->start;
 
-       err = __iommu_map_sg(tegra->domain, bo->paddr, bo->sgt->sgl,
-                            bo->sgt->nents, prot);
+       err = iommu_map_sg(tegra->domain, bo->paddr, bo->sgt->sgl,
+                          bo->sgt->nents, prot);
        if (err < 0) {
                dev_err(tegra->drm->dev, "failed to map buffer: %zd\n", err);
                goto remove;