diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-05-16 16:59:31 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-05-24 15:14:03 -0400 |
commit | ee25b33ca4aafbbab6e9b7cd963f9011a59037cd (patch) | |
tree | 80f10d0027de77ea23a5c6b71c46b7da61c61102 /drivers/gpu/nvgpu/gk20a/fence_gk20a.c | |
parent | 9db45cf0376c6de8d71cc8087d0ec76dff72c00b (diff) |
gpu: nvgpu: Proper timeout for NVGPU_COND_WAIT
The timeout parameter to NVGPU_COND_WAIT()
was passed directly to wait_event_timeout(), which takes jiffies.
Also allows zero timeout to disable timeout.
The return value of NVGPU_COND_WAIT() was defined in a way specific
to how Linux wait_event_() calls work. Replace that with proper error
reporting and change the callers to check against error codes.
JIRA NVGPU-14
Change-Id: Idbd2c8fbbef7589c3ca4f4c5732852bc71217515
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1484927
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fence_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index 3964c37d..7c5d33c7 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c | |||
@@ -203,20 +203,13 @@ void gk20a_init_fence(struct gk20a_fence *f, | |||
203 | 203 | ||
204 | static int nvgpu_semaphore_fence_wait(struct gk20a_fence *f, long timeout) | 204 | static int nvgpu_semaphore_fence_wait(struct gk20a_fence *f, long timeout) |
205 | { | 205 | { |
206 | long remain; | ||
207 | |||
208 | if (!nvgpu_semaphore_is_acquired(f->semaphore)) | 206 | if (!nvgpu_semaphore_is_acquired(f->semaphore)) |
209 | return 0; | 207 | return 0; |
210 | 208 | ||
211 | remain = NVGPU_COND_WAIT_INTERRUPTIBLE( | 209 | return NVGPU_COND_WAIT_INTERRUPTIBLE( |
212 | f->semaphore_wq, | 210 | f->semaphore_wq, |
213 | !nvgpu_semaphore_is_acquired(f->semaphore), | 211 | !nvgpu_semaphore_is_acquired(f->semaphore), |
214 | timeout); | 212 | timeout); |
215 | if (remain == 0 && nvgpu_semaphore_is_acquired(f->semaphore)) | ||
216 | return -ETIMEDOUT; | ||
217 | else if (remain < 0) | ||
218 | return remain; | ||
219 | return 0; | ||
220 | } | 213 | } |
221 | 214 | ||
222 | static bool nvgpu_semaphore_fence_is_expired(struct gk20a_fence *f) | 215 | static bool nvgpu_semaphore_fence_is_expired(struct gk20a_fence *f) |