[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 01/10] drm/vram-helper: Remove invariant parameters from internal kmap function



Am 15.10.20 um 14:37 schrieb Thomas Zimmermann:
The parameters map and is_iomem are always of the same value. Removed them
to prepares the function for conversion to struct dma_buf_map.

v4:
        * don't check for !kmap->virtual; will always be false

Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

Reviewed-by: Christian König <christian.koenig@xxxxxxx>

---
  drivers/gpu/drm/drm_gem_vram_helper.c | 18 ++++--------------
  1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c 
b/drivers/gpu/drm/drm_gem_vram_helper.c
index 3213429f8444..2d5ed30518f1 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -382,32 +382,22 @@ int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo)
  }
  EXPORT_SYMBOL(drm_gem_vram_unpin);
-static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo,
-                                     bool map, bool *is_iomem)
+static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo)
  {
        int ret;
        struct ttm_bo_kmap_obj *kmap = &gbo->kmap;
+       bool is_iomem;
if (gbo->kmap_use_count > 0)
                goto out;
- if (kmap->virtual || !map)
-               goto out;
-
        ret = ttm_bo_kmap(&gbo->bo, 0, gbo->bo.num_pages, kmap);
        if (ret)
                return ERR_PTR(ret);
out:
-       if (!kmap->virtual) {
-               if (is_iomem)
-                       *is_iomem = false;
-               return NULL; /* not mapped; don't increment ref */
-       }
        ++gbo->kmap_use_count;
-       if (is_iomem)
-               return ttm_kmap_obj_virtual(kmap, is_iomem);
-       return kmap->virtual;
+       return ttm_kmap_obj_virtual(kmap, &is_iomem);
  }
static void drm_gem_vram_kunmap_locked(struct drm_gem_vram_object *gbo)
@@ -452,7 +442,7 @@ void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo)
        ret = drm_gem_vram_pin_locked(gbo, 0);
        if (ret)
                goto err_ttm_bo_unreserve;
-       base = drm_gem_vram_kmap_locked(gbo, true, NULL);
+       base = drm_gem_vram_kmap_locked(gbo);
        if (IS_ERR(base)) {
                ret = PTR_ERR(base);
                goto err_drm_gem_vram_unpin_locked;




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.