drm/amdgpu: use the new iterator in amdgpu_sync_resv
Simplifying the code a bit. 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-12-christian.koenig@amd.com
This commit is contained in:
@@ -252,41 +252,25 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync,
|
|||||||
struct dma_resv *resv, enum amdgpu_sync_mode mode,
|
struct dma_resv *resv, enum amdgpu_sync_mode mode,
|
||||||
void *owner)
|
void *owner)
|
||||||
{
|
{
|
||||||
struct dma_resv_list *flist;
|
struct dma_resv_iter cursor;
|
||||||
struct dma_fence *f;
|
struct dma_fence *f;
|
||||||
unsigned i;
|
int r;
|
||||||
int r = 0;
|
|
||||||
|
|
||||||
if (resv == NULL)
|
if (resv == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* always sync to the exclusive fence */
|
dma_resv_for_each_fence(&cursor, resv, true, f) {
|
||||||
f = dma_resv_excl_fence(resv);
|
dma_fence_chain_for_each(f, f) {
|
||||||
dma_fence_chain_for_each(f, f) {
|
struct dma_fence_chain *chain = to_dma_fence_chain(f);
|
||||||
struct dma_fence_chain *chain = to_dma_fence_chain(f);
|
|
||||||
|
|
||||||
if (amdgpu_sync_test_fence(adev, mode, owner, chain ?
|
if (amdgpu_sync_test_fence(adev, mode, owner, chain ?
|
||||||
chain->fence : f)) {
|
chain->fence : f)) {
|
||||||
r = amdgpu_sync_fence(sync, f);
|
r = amdgpu_sync_fence(sync, f);
|
||||||
dma_fence_put(f);
|
dma_fence_put(f);
|
||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
flist = dma_resv_shared_list(resv);
|
|
||||||
if (!flist)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (i = 0; i < flist->shared_count; ++i) {
|
|
||||||
f = rcu_dereference_protected(flist->shared[i],
|
|
||||||
dma_resv_held(resv));
|
|
||||||
|
|
||||||
if (amdgpu_sync_test_fence(adev, mode, owner, f)) {
|
|
||||||
r = amdgpu_sync_fence(sync, f);
|
|
||||||
if (r)
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user