summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-05-16 16:59:31 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-24 15:14:03 -0400
commitee25b33ca4aafbbab6e9b7cd963f9011a59037cd (patch)
tree80f10d0027de77ea23a5c6b71c46b7da61c61102 /drivers/gpu/nvgpu/gk20a/channel_gk20a.c
parent9db45cf0376c6de8d71cc8087d0ec76dff72c00b (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/channel_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c10
1 files changed, 5 insertions, 5 deletions
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(
409 if (NVGPU_COND_WAIT( 409 if (NVGPU_COND_WAIT(
410 c, 410 c,
411 atomic_read(counter) == wait_value, 411 atomic_read(counter) == wait_value,
412 msecs_to_jiffies(5000)) > 0) 412 5000) == 0)
413 break; 413 break;
414 414
415 nvgpu_warn(ch->g, 415 nvgpu_warn(ch->g,
@@ -1798,14 +1798,14 @@ static int gk20a_channel_poll_worker(void *arg)
1798 1798
1799 start_wait = jiffies; 1799 start_wait = jiffies;
1800 while (!nvgpu_thread_should_stop(&worker->poll_task)) { 1800 while (!nvgpu_thread_should_stop(&worker->poll_task)) {
1801 bool got_events; 1801 int ret;
1802 1802
1803 got_events = NVGPU_COND_WAIT( 1803 ret = NVGPU_COND_WAIT(
1804 &worker->wq, 1804 &worker->wq,
1805 __gk20a_channel_worker_pending(g, get), 1805 __gk20a_channel_worker_pending(g, get),
1806 timeout) > 0; 1806 jiffies_to_msecs(timeout)) > 0;
1807 1807
1808 if (got_events) 1808 if (ret == 0)
1809 gk20a_channel_worker_process(g, &get); 1809 gk20a_channel_worker_process(g, &get);
1810 1810
1811 if (jiffies - start_wait >= timeout) { 1811 if (jiffies - start_wait >= timeout) {