gpu: host1x: Don't rely on dma_fence_wait_timeout return value
authorMikko Perttunen <mperttunen@nvidia.com>
Wed, 1 Mar 2023 13:51:06 +0000 (15:51 +0200)
committerThierry Reding <treding@nvidia.com>
Tue, 4 Apr 2023 12:24:24 +0000 (14:24 +0200)
commitc1aaee94380874fd40f7bb8417c597aba3f72c75
tree0193b6841f85b30d86aee9ede799e2c9400916e3
parent1d83d1a2df0bfb6bd79400746c289e2c4edc5909
gpu: host1x: Don't rely on dma_fence_wait_timeout return value

dma_fence_wait_timeout (along with a host of other jiffies-based
timeouting functions) returns zero both in case of timeout and when
the wait completes during the last jiffy before timeout. As such,
we can't rely on it to distinguish between success and timeout.

To prevent confusing callers by returning -EAGAIN before the timeout
period has elapsed, check if the fence got signaled again after
the wait.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/host1x/syncpt.c