drm/ttm: cleanup some more resv->lock uses
authorChristian König <christian.koenig@amd.com>
Fri, 15 Dec 2017 16:27:28 +0000 (17:27 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 18 Dec 2017 16:52:54 +0000 (11:52 -0500)
Use the reservation wrapper for this.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.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

index 122a964cac4045bfc86997b27a0d2cdbfd8cfaa6..5cc96b232c1761df2a544559f8b584ca4a858681 100644 (file)
@@ -165,7 +165,7 @@ void ttm_bo_add_to_lru(struct ttm_buffer_object *bo)
        struct ttm_bo_device *bdev = bo->bdev;
        struct ttm_mem_type_manager *man;
 
-       lockdep_assert_held(&bo->resv->lock.base);
+       reservation_object_assert_held(bo->resv);
 
        if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
 
@@ -216,7 +216,7 @@ EXPORT_SYMBOL(ttm_bo_del_sub_from_lru);
 
 void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo)
 {
-       lockdep_assert_held(&bo->resv->lock.base);
+       reservation_object_assert_held(bo->resv);
 
        ttm_bo_del_from_lru(bo);
        ttm_bo_add_to_lru(bo);
@@ -665,7 +665,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo,
        struct ttm_placement placement;
        int ret = 0;
 
-       lockdep_assert_held(&bo->resv->lock.base);
+       reservation_object_assert_held(bo->resv);
 
        evict_mem = bo->mem;
        evict_mem.mm_node = NULL;
@@ -1022,7 +1022,7 @@ static int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
        int ret = 0;
        struct ttm_mem_reg mem;
 
-       lockdep_assert_held(&bo->resv->lock.base);
+       reservation_object_assert_held(bo->resv);
 
        mem.num_pages = bo->num_pages;
        mem.size = mem.num_pages << PAGE_SHIFT;
@@ -1092,7 +1092,7 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
        int ret;
        uint32_t new_flags;
 
-       lockdep_assert_held(&bo->resv->lock.base);
+       reservation_object_assert_held(bo->resv);
        /*
         * Check whether we need to move buffer.
         */
@@ -1186,7 +1186,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
        bo->sg = sg;
        if (resv) {
                bo->resv = resv;
-               lockdep_assert_held(&bo->resv->lock.base);
+               reservation_object_assert_held(bo->resv);
        } else {
                bo->resv = &bo->ttm_resv;
        }
@@ -1208,7 +1208,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
         * since otherwise lockdep will be angered in radeon.
         */
        if (!resv) {
-               locked = ww_mutex_trylock(&bo->resv->lock);
+               locked = reservation_object_trylock(bo->resv);
                WARN_ON(!locked);
        }
 
index 9237099a7c49828d11dc77dd1a842a97c673049b..6e353df4e4bcfd30283dd4bbd63850d4aa33f2b4 100644 (file)
@@ -485,7 +485,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
        fbo->acc_size = 0;
        fbo->resv = &fbo->ttm_resv;
        reservation_object_init(fbo->resv);
-       ret = ww_mutex_trylock(&fbo->resv->lock);
+       ret = reservation_object_trylock(fbo->resv);
        WARN_ON(!ret);
 
        *new_obj = fbo;