]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/ttm: wrap tt destroy. (v2)
authorDave Airlie <airlied@redhat.com>
Tue, 15 Sep 2020 01:02:12 +0000 (11:02 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 15 Sep 2020 23:33:53 +0000 (09:33 +1000)
All places this was called was using bo->ttm either direct
or indirectly.

v2: move to ttm_bo

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-3-airlied@gmail.com
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_util.c
include/drm/ttm/ttm_bo_driver.h

index ee2632128d3c6a3c5d3788f1c88f4beebae9b9d2..aea61017f03a17316944bd241276677b012a094b 100644 (file)
@@ -301,10 +301,8 @@ moved:
 
 out_err:
        new_man = ttm_manager_type(bdev, bo->mem.mem_type);
-       if (!new_man->use_tt) {
-               ttm_tt_destroy(bdev, bo->ttm);
-               bo->ttm = NULL;
-       }
+       if (!new_man->use_tt)
+               ttm_bo_tt_destroy(bo);
 
        return ret;
 }
@@ -322,8 +320,7 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
        if (bo->bdev->driver->move_notify)
                bo->bdev->driver->move_notify(bo, false, NULL);
 
-       ttm_tt_destroy(bo->bdev, bo->ttm);
-       bo->ttm = NULL;
+       ttm_bo_tt_destroy(bo);
        ttm_resource_free(bo, &bo->mem);
 }
 
@@ -1613,3 +1610,9 @@ void ttm_bo_swapout_all(void)
        while (ttm_bo_swapout(&ttm_bo_glob, &ctx) == 0);
 }
 EXPORT_SYMBOL(ttm_bo_swapout_all);
+
+void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)
+{
+       ttm_tt_destroy(bo->bdev, bo->ttm);
+       bo->ttm = NULL;
+}
index 44b47ccdeaf7e9ce142a79ee939d33d23245d186..0d2f3bc5df92a4da98e20c1e50ba80ea47e5d02f 100644 (file)
@@ -297,10 +297,8 @@ out2:
        *old_mem = *new_mem;
        new_mem->mm_node = NULL;
 
-       if (!man->use_tt) {
-               ttm_tt_destroy(bdev, ttm);
-               bo->ttm = NULL;
-       }
+       if (!man->use_tt)
+               ttm_bo_tt_destroy(bo);
 
 out1:
        ttm_resource_iounmap(bdev, old_mem, new_iomap);
@@ -542,10 +540,8 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
                if (ret)
                        return ret;
 
-               if (!man->use_tt) {
-                       ttm_tt_destroy(bdev, bo->ttm);
-                       bo->ttm = NULL;
-               }
+               if (!man->use_tt)
+                       ttm_bo_tt_destroy(bo);
                ttm_bo_free_old_node(bo);
        } else {
                /**
@@ -665,10 +661,8 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
                if (ret)
                        return ret;
 
-               if (!to->use_tt) {
-                       ttm_tt_destroy(bdev, bo->ttm);
-                       bo->ttm = NULL;
-               }
+               if (!to->use_tt)
+                       ttm_bo_tt_destroy(bo);
                ttm_bo_free_old_node(bo);
        }
 
index 0b7d18650dc5319ced4cfafe018b058a408472be..70557e2de9be73e49c02e7cec38140fff5c7be8f 100644 (file)
@@ -684,6 +684,11 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo);
  */
 pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
 
+/**
+ * ttm_bo_tt_destroy.
+ */
+void ttm_bo_tt_destroy(struct ttm_buffer_object *bo);
+
 /**
  * ttm_range_man_init
  *