summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-01-04 14:12:21 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-09 22:01:56 +0100
commitd3b029a44e14f5226fd9b410a0a70eb9b7ed6beb (patch)
tree49b3c37d047ca555b14b04d94f593f0c86aa14cf /include/linux
parentf55d17e9c3af7bf2fdb38c52a9abe4d4cfc0137c (diff)
downloadlinux-stable-d3b029a44e14f5226fd9b410a0a70eb9b7ed6beb.tar.gz
linux-stable-d3b029a44e14f5226fd9b410a0a70eb9b7ed6beb.tar.bz2
linux-stable-d3b029a44e14f5226fd9b410a0a70eb9b7ed6beb.zip
dma-fence: Wrap querying the fence->status
commit d6c99f4bf093a58d3ab47caaec74b81f18bc4e3f upstream. 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 [s/dma_fence/fence/g - gregkh] Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fence.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/fence.h b/include/linux/fence.h
index fcb69f99d717..2dfed6957b61 100644
--- a/include/linux/fence.h
+++ b/include/linux/fence.h
@@ -334,6 +334,30 @@ static inline struct fence *fence_later(struct fence *f1, struct fence *f2)
return fence_is_signaled(f2) ? NULL : f2;
}
+/**
+ * fence_get_status_locked - returns the status upon completion
+ * @fence: [in] the fence to query
+ *
+ * Drivers can supply an optional error status condition before they signal
+ * the fence (to indicate whether the fence was completed due to an error
+ * rather than success). The value of the status condition is only valid
+ * if the fence has been signaled, fence_get_status_locked() first checks
+ * the signal state before reporting the error status.
+ *
+ * Returns 0 if the fence has not yet been signaled, 1 if the fence has
+ * been signaled without an error condition, or a negative error code
+ * if the fence has been completed in err.
+ */
+static inline int fence_get_status_locked(struct fence *fence)
+{
+ if (fence_is_signaled_locked(fence))
+ return fence->status < 0 ? fence->status : 1;
+ else
+ return 0;
+}
+
+int fence_get_status(struct fence *fence);
+
signed long fence_wait_timeout(struct fence *, bool intr, signed long timeout);
signed long fence_wait_any_timeout(struct fence **fences, uint32_t count,
bool intr, signed long timeout);