summaryrefslogtreecommitdiffstats
path: root/drivers/dma-buf/dma-fence.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-01-04 09:12:21 -0500
committerSumit Semwal <sumit.semwal@linaro.org>2017-01-09 09:36:58 -0500
commitd6c99f4bf093a58d3ab47caaec74b81f18bc4e3f (patch)
tree246eff35230c79ce6560cf7fe23ce453a6ed62bb /drivers/dma-buf/dma-fence.c
parent83dd1376fd92f33bdeca9e83d479534a4e7f870b (diff)
dma-fence: Wrap querying the fence->status
The fence->status is an optional field that is only valid once the fence has been signaled. (Driver may fill the fence->status with an error code prior to calling dma_fence_signal().) Given the restriction upon its validity, wrap querying of the fence->status into a helper dma_fence_get_status(). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Link: http://patchwork.freedesktop.org/patch/msgid/20170104141222.6992-2-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/dma-buf/dma-fence.c')
-rw-r--r--drivers/dma-buf/dma-fence.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index cb6eef308cd9..5e66dfece03c 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -282,6 +282,31 @@ int dma_fence_add_callback(struct dma_fence *fence, struct dma_fence_cb *cb,
282EXPORT_SYMBOL(dma_fence_add_callback); 282EXPORT_SYMBOL(dma_fence_add_callback);
283 283
284/** 284/**
285 * dma_fence_get_status - returns the status upon completion
286 * @fence: [in] the dma_fence to query
287 *
288 * This wraps dma_fence_get_status_locked() to return the error status
289 * condition on a signaled fence. See dma_fence_get_status_locked() for more
290 * details.
291 *
292 * Returns 0 if the fence has not yet been signaled, 1 if the fence has
293 * been signaled without an error condition, or a negative error code
294 * if the fence has been completed in err.
295 */
296int dma_fence_get_status(struct dma_fence *fence)
297{
298 unsigned long flags;
299 int status;
300
301 spin_lock_irqsave(fence->lock, flags);
302 status = dma_fence_get_status_locked(fence);
303 spin_unlock_irqrestore(fence->lock, flags);
304
305 return status;
306}
307EXPORT_SYMBOL(dma_fence_get_status);
308
309/**
285 * dma_fence_remove_callback - remove a callback from the signaling list 310 * dma_fence_remove_callback - remove a callback from the signaling list
286 * @fence: [in] the fence to wait on 311 * @fence: [in] the fence to wait on
287 * @cb: [in] the callback to remove 312 * @cb: [in] the callback to remove