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/common/linux/ioctl_channel.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 4d4d1690..c7adb76c 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c @@ -392,7 +392,6 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch, void *data; u32 *semaphore; int ret = 0; - long remain; /* do not wait if channel has timed out */ if (ch->has_timedout) @@ -413,16 +412,11 @@ static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch, semaphore = data + (offset & ~PAGE_MASK); - remain = NVGPU_COND_WAIT_INTERRUPTIBLE( + ret = NVGPU_COND_WAIT_INTERRUPTIBLE( &ch->semaphore_wq, *semaphore == payload || ch->has_timedout, timeout); - if (remain == 0 && *semaphore != payload) - ret = -ETIMEDOUT; - else if (remain < 0) - ret = remain; - dma_buf_kunmap(dmabuf, offset >> PAGE_SHIFT, data); cleanup_put: dma_buf_put(dmabuf); -- cgit v1.2.2