]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/ttm: cleanup ttm_tt_(unbind|destroy)
authorChristian König <christian.koenig@amd.com>
Mon, 6 Jun 2016 08:17:50 +0000 (10:17 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 18:54:33 +0000 (14:54 -0400)
ttm_tt_destroy should be the only one unbinding the object.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/gpu/drm/ttm/ttm_tt.c
include/drm/ttm/ttm_bo_driver.h

index 39386f50af876fd9494f9064384c5d050918d301..4216b3162a8d0baf3826fb39340e00dcea2d3e4c 100644 (file)
@@ -397,7 +397,6 @@ moved:
 out_err:
        new_man = &bdev->man[bo->mem.mem_type];
        if ((new_man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm) {
-               ttm_tt_unbind(bo->ttm);
                ttm_tt_destroy(bo->ttm);
                bo->ttm = NULL;
        }
@@ -419,7 +418,6 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
                bo->bdev->driver->move_notify(bo, NULL);
 
        if (bo->ttm) {
-               ttm_tt_unbind(bo->ttm);
                ttm_tt_destroy(bo->ttm);
                bo->ttm = NULL;
        }
index d9831559706eb9312cf4803ac43e7113a6e41c5c..4194b7ea7a725f7cb5413cda4a6ed46cc09f0d45 100644 (file)
@@ -53,7 +53,6 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
        int ret;
 
        if (old_mem->mem_type != TTM_PL_SYSTEM) {
-               ttm_tt_unbind(ttm);
                ttm_bo_free_old_node(bo);
                ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM,
                                TTM_PL_MASK_MEM);
@@ -402,7 +401,6 @@ out2:
        new_mem->mm_node = NULL;
 
        if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && (ttm != NULL)) {
-               ttm_tt_unbind(ttm);
                ttm_tt_destroy(ttm);
                bo->ttm = NULL;
        }
@@ -651,7 +649,6 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
 
                if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) &&
                    (bo->ttm != NULL)) {
-                       ttm_tt_unbind(bo->ttm);
                        ttm_tt_destroy(bo->ttm);
                        bo->ttm = NULL;
                }
index 077ae9b2865dcda4bb8d9e774a8b4a5cf498bc84..79f6323771e2678db140f280832f9817dd5e5ba4 100644 (file)
@@ -166,11 +166,15 @@ EXPORT_SYMBOL(ttm_tt_set_placement_caching);
 
 void ttm_tt_destroy(struct ttm_tt *ttm)
 {
+       int ret;
+
        if (unlikely(ttm == NULL))
                return;
 
        if (ttm->state == tt_bound) {
-               ttm_tt_unbind(ttm);
+               ret = ttm->func->unbind(ttm);
+               BUG_ON(ret);
+               ttm->state = tt_unbound;
        }
 
        if (ttm->state == tt_unbound)
@@ -251,17 +255,6 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma)
 }
 EXPORT_SYMBOL(ttm_dma_tt_fini);
 
-void ttm_tt_unbind(struct ttm_tt *ttm)
-{
-       int ret;
-
-       if (ttm->state == tt_bound) {
-               ret = ttm->func->unbind(ttm);
-               BUG_ON(ret);
-               ttm->state = tt_unbound;
-       }
-}
-
 int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
 {
        int ret = 0;
index 513f7f96b80a90e530a4c74179f943a0dff8c40f..da6ee17d7c0b1f14d46fe2ce9c29c31d9fe5f86a 100644 (file)
@@ -622,15 +622,6 @@ extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
  */
 extern void ttm_tt_destroy(struct ttm_tt *ttm);
 
-/**
- * ttm_ttm_unbind:
- *
- * @ttm: The struct ttm_tt.
- *
- * Unbind a struct ttm_tt.
- */
-extern void ttm_tt_unbind(struct ttm_tt *ttm);
-
 /**
  * ttm_tt_swapin:
  *