This reverts commit 56b3d20413587fab6a790cfc8bc075ca94bc8ed9.

Signed-off-by: Karol Herbst <kher...@redhat.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c    | 14 +++++---------
 include/drm/ttm/ttm_bo_driver.h |  1 +
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index c0efe4c89baf..99322c3d6573 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -45,11 +45,6 @@
 
 static void ttm_bo_global_kobj_release(struct kobject *kobj);
 
-/**
- * ttm_global_mutex - protecting the global BO state
- */
-DEFINE_MUTEX(ttm_global_mutex);
-
 static struct attribute ttm_bo_count = {
        .name = "bo_count",
        .mode = S_IRUGO
@@ -1545,6 +1540,7 @@ int ttm_bo_global_init(struct ttm_bo_global *glob)
        if (ret)
                return ret;
 
+       mutex_init(&glob->device_list_mutex);
        spin_lock_init(&glob->lru_lock);
        glob->mem_glob = &ttm_mem_glob;
        glob->mem_glob->bo_glob = glob;
@@ -1592,9 +1588,9 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev)
                }
        }
 
-       mutex_lock(&ttm_global_mutex);
+       mutex_lock(&glob->device_list_mutex);
        list_del(&bdev->device_list);
-       mutex_unlock(&ttm_global_mutex);
+       mutex_unlock(&glob->device_list_mutex);
 
        cancel_delayed_work_sync(&bdev->wq);
 
@@ -1641,9 +1637,9 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
        bdev->dev_mapping = mapping;
        bdev->glob = glob;
        bdev->need_dma32 = need_dma32;
-       mutex_lock(&ttm_global_mutex);
+       mutex_lock(&glob->device_list_mutex);
        list_add_tail(&bdev->device_list, &glob->device_list);
-       mutex_unlock(&ttm_global_mutex);
+       mutex_unlock(&glob->device_list_mutex);
 
        return 0;
 out_no_sys:
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 9cec8835b88f..4ae6fc33f761 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -407,6 +407,7 @@ struct ttm_bo_global {
        struct kobject kobj;
        struct ttm_mem_global *mem_glob;
        struct page *dummy_read_page;
+       struct mutex device_list_mutex;
        spinlock_t lru_lock;
 
        /**
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to