From ee25b33ca4aafbbab6e9b7cd963f9011a59037cd Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Tue, 16 May 2017 13:59:31 -0700 Subject: 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 Reviewed-on: http://git-master/r/1484927 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 6cb77d67..4ee1ab43 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -409,7 +409,7 @@ static void gk20a_wait_until_counter_is_N( if (NVGPU_COND_WAIT( c, atomic_read(counter) == wait_value, - msecs_to_jiffies(5000)) > 0) + 5000) == 0) break; nvgpu_warn(ch->g, @@ -1798,14 +1798,14 @@ static int gk20a_channel_poll_worker(void *arg) start_wait = jiffies; while (!nvgpu_thread_should_stop(&worker->poll_task)) { - bool got_events; + int ret; - got_events = NVGPU_COND_WAIT( + ret = NVGPU_COND_WAIT( &worker->wq, __gk20a_channel_worker_pending(g, get), - timeout) > 0; + jiffies_to_msecs(timeout)) > 0; - if (got_events) + if (ret == 0) gk20a_channel_worker_process(g, &get); if (jiffies - start_wait >= timeout) { -- cgit v1.2.2