]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amdgpu: use dma_resv_get_singleton in amdgpu_pasid_free_cb
authorChristian König <christian.koenig@amd.com>
Mon, 8 Nov 2021 13:03:29 +0000 (14:03 +0100)
committerChristian König <christian.koenig@amd.com>
Sun, 3 Apr 2022 18:15:51 +0000 (20:15 +0200)
Makes the code a bit more simpler.

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

index be48487e2ca728b56336e7e5fc4194a3a3b19f7b..888d97143177b551ca920748ae85a0ee6a43fdc0 100644 (file)
@@ -107,36 +107,19 @@ static void amdgpu_pasid_free_cb(struct dma_fence *fence,
 void amdgpu_pasid_free_delayed(struct dma_resv *resv,
                               u32 pasid)
 {
-       struct dma_fence *fence, **fences;
        struct amdgpu_pasid_cb *cb;
-       unsigned count;
+       struct dma_fence *fence;
        int r;
 
-       r = dma_resv_get_fences(resv, true, &count, &fences);
+       r = dma_resv_get_singleton(resv, true, &fence);
        if (r)
                goto fallback;
 
-       if (count == 0) {
+       if (!fence) {
                amdgpu_pasid_free(pasid);
                return;
        }
 
-       if (count == 1) {
-               fence = fences[0];
-               kfree(fences);
-       } else {
-               uint64_t context = dma_fence_context_alloc(1);
-               struct dma_fence_array *array;
-
-               array = dma_fence_array_create(count, fences, context,
-                                              1, false);
-               if (!array) {
-                       kfree(fences);
-                       goto fallback;
-               }
-               fence = &array->base;
-       }
-
        cb = kmalloc(sizeof(*cb), GFP_KERNEL);
        if (!cb) {
                /* Last resort when we are OOM */