summaryrefslogtreecommitdiffstats
path: root/drivers/dma-buf
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2016-11-07 16:16:13 -0500
committerSumit Semwal <sumit.semwal@linaro.org>2016-11-08 14:15:14 -0500
commitbcc004b629d22ae202988e4c5424564e0b4f1217 (patch)
tree74daa7068485ec53de499fe73e45ebcd2087cb4f /drivers/dma-buf
parenteef18a827a9ec58aa9fc1ccfb7e65ff04ebc25f3 (diff)
dma-buf/fence: make timeout handling in fence_default_wait consistent (v2)
Kernel functions taking a timeout usually return 1 on success even when they get a zero timeout. v2: agd: rebase on drm-next Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Link: http://patchwork.freedesktop.org/patch/msgid/1478553376-18575-1-git-send-email-alexander.deucher@amd.com
Diffstat (limited to 'drivers/dma-buf')
-rw-r--r--drivers/dma-buf/dma-fence.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index cda40cbd8c43..70f4fcc0bc03 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -339,18 +339,20 @@ dma_fence_default_wait_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
339 * @timeout: [in] timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT 339 * @timeout: [in] timeout value in jiffies, or MAX_SCHEDULE_TIMEOUT
340 * 340 *
341 * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the 341 * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or the
342 * remaining timeout in jiffies on success. 342 * remaining timeout in jiffies on success. If timeout is zero the value one is
343 * returned if the fence is already signaled for consistency with other
344 * functions taking a jiffies timeout.
343 */ 345 */
344signed long 346signed long
345dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout) 347dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
346{ 348{
347 struct default_wait_cb cb; 349 struct default_wait_cb cb;
348 unsigned long flags; 350 unsigned long flags;
349 signed long ret = timeout; 351 signed long ret = timeout ? timeout : 1;
350 bool was_set; 352 bool was_set;
351 353
352 if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) 354 if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
353 return timeout; 355 return ret;
354 356
355 spin_lock_irqsave(fence->lock, flags); 357 spin_lock_irqsave(fence->lock, flags);
356 358