Simplifying the code a bit.

Untested since I can't get the driver to compile on !ARM.

Signed-off-by: Christian König <christian.koe...@amd.com>
---
 drivers/gpu/drm/msm/msm_gem.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 72a07e311de3..24f8c0603385 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -813,25 +813,11 @@ void msm_gem_vunmap(struct drm_gem_object *obj)
 int msm_gem_sync_object(struct drm_gem_object *obj,
                struct msm_fence_context *fctx, bool exclusive)
 {
-       struct dma_resv_list *fobj;
+       struct dma_resv_cursor cursor;
        struct dma_fence *fence;
-       int i, ret;
-
-       fence = dma_resv_excl_fence(obj->resv);
-       /* don't need to wait on our own fences, since ring is fifo */
-       if (fence && (fence->context != fctx->context)) {
-               ret = dma_fence_wait(fence, true);
-               if (ret)
-                       return ret;
-       }
-
-       fobj = dma_resv_shared_list(obj->resv);
-       if (!exclusive || !fobj)
-               return 0;
+       int ret;
 
-       for (i = 0; i < fobj->shared_count; i++) {
-               fence = rcu_dereference_protected(fobj->shared[i],
-                                               dma_resv_held(obj->resv));
+       dma_resv_for_each_fence(obj->resv, &cursor, exclusive, fence) {
                if (fence->context != fctx->context) {
                        ret = dma_fence_wait(fence, true);
                        if (ret)
-- 
2.25.1

Reply via email to