Commit b8c036df authored by Christian König's avatar Christian König

dma-buf: simplify reservation_object_get_fences_rcu a bit

We can add the exclusive fence to the list after making sure we got
a consistent state.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/322034/?series=64786&rev=1
parent 4c2488cf
...@@ -459,13 +459,6 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, ...@@ -459,13 +459,6 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
if (!dma_fence_get_rcu(shared[i])) if (!dma_fence_get_rcu(shared[i]))
break; break;
} }
if (!pfence_excl && fence_excl) {
shared[i] = fence_excl;
fence_excl = NULL;
++i;
++shared_count;
}
} }
if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) { if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) {
...@@ -480,6 +473,11 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, ...@@ -480,6 +473,11 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
rcu_read_unlock(); rcu_read_unlock();
} while (ret); } while (ret);
if (pfence_excl)
*pfence_excl = fence_excl;
else if (fence_excl)
shared[++shared_count] = fence_excl;
if (!shared_count) { if (!shared_count) {
kfree(shared); kfree(shared);
shared = NULL; shared = NULL;
...@@ -487,9 +485,6 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, ...@@ -487,9 +485,6 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj,
*pshared_count = shared_count; *pshared_count = shared_count;
*pshared = shared; *pshared = shared;
if (pfence_excl)
*pfence_excl = fence_excl;
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(reservation_object_get_fences_rcu); EXPORT_SYMBOL_GPL(reservation_object_get_fences_rcu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment