drm/msm: use new iterator in msm_gem_describe
authorChristian König <christian.koenig@amd.com>
Wed, 16 Jun 2021 07:19:37 +0000 (09:19 +0200)
committerChristian König <christian.koenig@amd.com>
Wed, 20 Oct 2021 12:07:20 +0000 (14:07 +0200)
Simplifying the code a bit. Also drop the RCU read side lock since the
object is locked anyway.

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

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-15-christian.koenig@amd.com
drivers/gpu/drm/msm/msm_gem.c

index 40a9863..5bd511f 100644 (file)
@@ -880,7 +880,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m,
 {
        struct msm_gem_object *msm_obj = to_msm_bo(obj);
        struct dma_resv *robj = obj->resv;
-       struct dma_resv_list *fobj;
+       struct dma_resv_iter cursor;
        struct dma_fence *fence;
        struct msm_gem_vma *vma;
        uint64_t off = drm_vma_node_start(&obj->vma_node);
@@ -955,22 +955,13 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m,
                seq_puts(m, "\n");
        }
 
-       rcu_read_lock();
-       fobj = dma_resv_shared_list(robj);
-       if (fobj) {
-               unsigned int i, shared_count = fobj->shared_count;
-
-               for (i = 0; i < shared_count; i++) {
-                       fence = rcu_dereference(fobj->shared[i]);
+       dma_resv_for_each_fence(&cursor, robj, true, fence) {
+               if (dma_resv_iter_is_exclusive(&cursor))
+                       describe_fence(fence, "Exclusive", m);
+               else
                        describe_fence(fence, "Shared", m);
-               }
        }
 
-       fence = dma_resv_excl_fence(robj);
-       if (fence)
-               describe_fence(fence, "Exclusive", m);
-       rcu_read_unlock();
-
        msm_gem_unlock(obj);
 }