Skip to content

Commit cd34db4

Browse files
icklesumitsemwal
authored andcommitted
drm/etnaviv: Remove manual call to reservation_object_test_signaled_rcu before wait
Since fence_wait_timeout_reservation_object_wait_timeout_rcu() with a timeout of 0 becomes reservation_object_test_signaled_rcu(), we do not need to handle such conversion in the caller. The only challenge are those callers that wish to differentiate the error code between the nonblocking busy check and potentially blocking wait. Signed-off-by: Chris Wilson <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Russell King <[email protected]> Cc: Christian Gmeiner <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Acked-by: Lucas Stach <[email protected]> Signed-off-by: Sumit Semwal <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 0fea2ed commit cd34db4

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

drivers/gpu/drm/etnaviv/etnaviv_gem.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -409,20 +409,16 @@ int etnaviv_gem_cpu_prep(struct drm_gem_object *obj, u32 op,
409409
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
410410
struct drm_device *dev = obj->dev;
411411
bool write = !!(op & ETNA_PREP_WRITE);
412-
int ret;
413-
414-
if (op & ETNA_PREP_NOSYNC) {
415-
if (!reservation_object_test_signaled_rcu(etnaviv_obj->resv,
416-
write))
417-
return -EBUSY;
418-
} else {
419-
unsigned long remain = etnaviv_timeout_to_jiffies(timeout);
420-
421-
ret = reservation_object_wait_timeout_rcu(etnaviv_obj->resv,
422-
write, true, remain);
423-
if (ret <= 0)
424-
return ret == 0 ? -ETIMEDOUT : ret;
425-
}
412+
unsigned long remain =
413+
op & ETNA_PREP_NOSYNC ? 0 : etnaviv_timeout_to_jiffies(timeout);
414+
long lret;
415+
416+
lret = reservation_object_wait_timeout_rcu(etnaviv_obj->resv,
417+
write, true, remain);
418+
if (lret < 0)
419+
return lret;
420+
else if (lret == 0)
421+
return remain == 0 ? -EBUSY : -ETIMEDOUT;
426422

427423
if (etnaviv_obj->flags & ETNA_BO_CACHED) {
428424
if (!etnaviv_obj->sgt) {

0 commit comments

Comments
 (0)