drm/ttm: Reorder sys manager cleanup step
authorjsg <jsg@openbsd.org>
Thu, 9 Nov 2023 08:08:17 +0000 (08:08 +0000)
committerjsg <jsg@openbsd.org>
Thu, 9 Nov 2023 08:08:17 +0000 (08:08 +0000)
From Karolina Stolarek
6a87b333ba4784ba23c1e74693f5c1b0268ac137 in linux-6.1.y/6.1.62
3b401e30c249849d803de6c332dad2a595a58658 in mainline linux

sys/dev/pci/drm/ttm/ttm_device.c

index d4ad7ed..a1f6463 100644 (file)
@@ -235,10 +235,6 @@ void ttm_device_fini(struct ttm_device *bdev)
        struct ttm_resource_manager *man;
        unsigned i;
 
-       man = ttm_manager_type(bdev, TTM_PL_SYSTEM);
-       ttm_resource_manager_set_used(man, false);
-       ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL);
-
        mutex_lock(&ttm_global_mutex);
        list_del(&bdev->device_list);
        mutex_unlock(&ttm_global_mutex);
@@ -248,6 +244,10 @@ void ttm_device_fini(struct ttm_device *bdev)
        if (ttm_bo_delayed_delete(bdev, true))
                pr_debug("Delayed destroy list was clean\n");
 
+       man = ttm_manager_type(bdev, TTM_PL_SYSTEM);
+       ttm_resource_manager_set_used(man, false);
+       ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL);
+
        spin_lock(&bdev->lru_lock);
        for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i)
                if (list_empty(&man->lru[0]))