Commit 1086db71 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/vram-helper: Remove invariant parameters from internal kmap function

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Tested-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201103093015.1063-2-tzimmermann@suse.de
parent 3fb91f56
...@@ -378,32 +378,22 @@ int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo) ...@@ -378,32 +378,22 @@ int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo)
} }
EXPORT_SYMBOL(drm_gem_vram_unpin); EXPORT_SYMBOL(drm_gem_vram_unpin);
static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo, static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo)
bool map, bool *is_iomem)
{ {
int ret; int ret;
struct ttm_bo_kmap_obj *kmap = &gbo->kmap; struct ttm_bo_kmap_obj *kmap = &gbo->kmap;
bool is_iomem;
if (gbo->kmap_use_count > 0) if (gbo->kmap_use_count > 0)
goto out; goto out;
if (kmap->virtual || !map)
goto out;
ret = ttm_bo_kmap(&gbo->bo, 0, gbo->bo.num_pages, kmap); ret = ttm_bo_kmap(&gbo->bo, 0, gbo->bo.num_pages, kmap);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
out: out:
if (!kmap->virtual) {
if (is_iomem)
*is_iomem = false;
return NULL; /* not mapped; don't increment ref */
}
++gbo->kmap_use_count; ++gbo->kmap_use_count;
if (is_iomem) return ttm_kmap_obj_virtual(kmap, &is_iomem);
return ttm_kmap_obj_virtual(kmap, is_iomem);
return kmap->virtual;
} }
static void drm_gem_vram_kunmap_locked(struct drm_gem_vram_object *gbo) static void drm_gem_vram_kunmap_locked(struct drm_gem_vram_object *gbo)
...@@ -448,7 +438,7 @@ void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo) ...@@ -448,7 +438,7 @@ void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo)
ret = drm_gem_vram_pin_locked(gbo, 0); ret = drm_gem_vram_pin_locked(gbo, 0);
if (ret) if (ret)
goto err_ttm_bo_unreserve; 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)) { if (IS_ERR(base)) {
ret = PTR_ERR(base); ret = PTR_ERR(base);
goto err_drm_gem_vram_unpin_locked; goto err_drm_gem_vram_unpin_locked;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment