drm/ttm: consistently use reservation_object_unlock
authorChristian König <christian.koenig@amd.com>
Wed, 8 Nov 2017 13:38:34 +0000 (14:38 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Dec 2017 17:47:19 +0000 (12:47 -0500)
Instead of having a confusing wrapper or call the underlying ww_mutex
function directly.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/qxl/qxl_release.c
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_execbuf_util.c
include/drm/ttm/ttm_bo_driver.h

index a6da6fa6ad5857f39df711731f962bff486f2dc6..f27777daae63ef46b2409cfc7780ac2dbada02f0 100644 (file)
@@ -468,7 +468,7 @@ void qxl_release_fence_buffer_objects(struct qxl_release *release)
 
                reservation_object_add_shared_fence(bo->resv, &release->base);
                ttm_bo_add_to_lru(bo);
-               __ttm_bo_unreserve(bo);
+               reservation_object_unlock(bo->resv);
        }
        spin_unlock(&glob->lru_lock);
        ww_acquire_fini(&release->ticket);
index 9905cf41cba6f0f51df9d3cff89d39a5f57faae4..6f55310a9d09f54934bb7ee151ef32d31f034181 100644 (file)
@@ -471,7 +471,7 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo)
                        ttm_bo_add_to_lru(bo);
                }
 
-               __ttm_bo_unreserve(bo);
+               reservation_object_unlock(bo->resv);
        }
        if (bo->resv != &bo->ttm_resv)
                reservation_object_unlock(&bo->ttm_resv);
@@ -517,7 +517,8 @@ static int ttm_bo_cleanup_refs_and_unlock(struct ttm_buffer_object *bo,
 
        if (ret && !no_wait_gpu) {
                long lret;
-               ww_mutex_unlock(&bo->resv->lock);
+
+               reservation_object_unlock(bo->resv);
                spin_unlock(&glob->lru_lock);
 
                lret = reservation_object_wait_timeout_rcu(resv, true,
@@ -547,7 +548,7 @@ static int ttm_bo_cleanup_refs_and_unlock(struct ttm_buffer_object *bo,
        }
 
        if (ret || unlikely(list_empty(&bo->ddestroy))) {
-               __ttm_bo_unreserve(bo);
+               reservation_object_unlock(bo->resv);
                spin_unlock(&glob->lru_lock);
                return ret;
        }
@@ -749,7 +750,7 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
 
                        if (place && !bdev->driver->eviction_valuable(bo,
                                                                      place)) {
-                               __ttm_bo_unreserve(bo);
+                               reservation_object_unlock(bo->resv);
                                ret = -EBUSY;
                                continue;
                        }
@@ -1788,7 +1789,7 @@ out:
         * already swapped buffer.
         */
 
-       __ttm_bo_unreserve(bo);
+       reservation_object_unlock(bo->resv);
        kref_put(&bo->list_kref, ttm_bo_release_list);
        return ret;
 }
@@ -1825,7 +1826,7 @@ int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo)
        ret = __ttm_bo_reserve(bo, true, false, NULL);
        if (unlikely(ret != 0))
                goto out_unlock;
-       __ttm_bo_unreserve(bo);
+       reservation_object_unlock(bo->resv);
 
 out_unlock:
        mutex_unlock(&bo->wu_mutex);
index 5e1bcabffef56abb33262fe8ea94efa4416c9612..373ced0b2fc246ce4f1ebd8164f51660fe6d0bc2 100644 (file)
@@ -38,7 +38,7 @@ static void ttm_eu_backoff_reservation_reverse(struct list_head *list,
        list_for_each_entry_continue_reverse(entry, list, head) {
                struct ttm_buffer_object *bo = entry->bo;
 
-               __ttm_bo_unreserve(bo);
+               reservation_object_unlock(bo->resv);
        }
 }
 
@@ -69,7 +69,7 @@ void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket,
                struct ttm_buffer_object *bo = entry->bo;
 
                ttm_bo_add_to_lru(bo);
-               __ttm_bo_unreserve(bo);
+               reservation_object_unlock(bo->resv);
        }
        spin_unlock(&glob->lru_lock);
 
@@ -112,7 +112,7 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
 
                ret = __ttm_bo_reserve(bo, intr, (ticket == NULL), ticket);
                if (!ret && unlikely(atomic_read(&bo->cpu_writers) > 0)) {
-                       __ttm_bo_unreserve(bo);
+                       reservation_object_unlock(bo->resv);
 
                        ret = -EBUSY;
 
@@ -203,7 +203,7 @@ void ttm_eu_fence_buffer_objects(struct ww_acquire_ctx *ticket,
                else
                        reservation_object_add_excl_fence(bo->resv, fence);
                ttm_bo_add_to_lru(bo);
-               __ttm_bo_unreserve(bo);
+               reservation_object_unlock(bo->resv);
        }
        spin_unlock(&glob->lru_lock);
        if (ticket)
index 5f821a9b3a1fa8110186c964a706805714a33966..389359a0006b16c41a381da285e6788c7bbb7d54 100644 (file)
@@ -940,18 +940,6 @@ static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
        return ret;
 }
 
-/**
- * __ttm_bo_unreserve
- * @bo: A pointer to a struct ttm_buffer_object.
- *
- * Unreserve a previous reservation of @bo where the buffer object is
- * already on lru lists.
- */
-static inline void __ttm_bo_unreserve(struct ttm_buffer_object *bo)
-{
-       ww_mutex_unlock(&bo->resv->lock);
-}
-
 /**
  * ttm_bo_unreserve
  *
@@ -966,7 +954,7 @@ static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
                ttm_bo_add_to_lru(bo);
                spin_unlock(&bo->glob->lru_lock);
        }
-       __ttm_bo_unreserve(bo);
+       reservation_object_unlock(bo->resv);
 }
 
 /**