diff options
author | Christian König <christian.koenig@amd.com> | 2021-09-13 13:44:01 +0200 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2021-10-07 14:49:11 +0200 |
commit | 7cd80132aeab30e4699f04e80d909678d231a558 (patch) | |
tree | 54009969ffc0bac23486d89310f1f48c6257164e /drivers/gpu/drm/drm_gem.c | |
parent | a585070f268223766fcab4b9eb9eade28381eb48 (diff) | |
download | linux-stable-7cd80132aeab30e4699f04e80d909678d231a558.tar.gz linux-stable-7cd80132aeab30e4699f04e80d909678d231a558.tar.bz2 linux-stable-7cd80132aeab30e4699f04e80d909678d231a558.zip |
drm: use new iterator in drm_gem_fence_array_add_implicit v3
Simplifying the code a bit.
v2: add missing rcu_read_lock()/unlock()
v3: switch to locked version
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-24-christian.koenig@amd.com
Diffstat (limited to 'drivers/gpu/drm/drm_gem.c')
-rw-r--r-- | drivers/gpu/drm/drm_gem.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 09c820045859..4dcdec6487bb 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -1340,31 +1340,15 @@ int drm_gem_fence_array_add_implicit(struct xarray *fence_array, struct drm_gem_object *obj, bool write) { - int ret; - struct dma_fence **fences; - unsigned int i, fence_count; - - if (!write) { - struct dma_fence *fence = - dma_resv_get_excl_unlocked(obj->resv); - - return drm_gem_fence_array_add(fence_array, fence); - } + struct dma_resv_iter cursor; + struct dma_fence *fence; + int ret = 0; - ret = dma_resv_get_fences(obj->resv, NULL, - &fence_count, &fences); - if (ret || !fence_count) - return ret; - - for (i = 0; i < fence_count; i++) { - ret = drm_gem_fence_array_add(fence_array, fences[i]); + dma_resv_for_each_fence(&cursor, obj->resv, write, fence) { + ret = drm_gem_fence_array_add(fence_array, fence); if (ret) break; } - - for (; i < fence_count; i++) - dma_fence_put(fences[i]); - kfree(fences); return ret; } EXPORT_SYMBOL(drm_gem_fence_array_add_implicit); |