dma-buf/fence-array: add fence_is_array()
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>
Fri, 5 Aug 2016 13:39:34 +0000 (10:39 -0300)
committerSumit Semwal <sumit.semwal@linaro.org>
Thu, 11 Aug 2016 10:03:23 +0000 (15:33 +0530)
Add helper to check if fence is array.

v2: Comments from Chris Wilson
- remove ternary if from ops comparison
- add EXPORT_SYMBOL(fence_array_ops)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
drivers/dma-buf/fence-array.c
include/linux/fence-array.h

index a8731c853da6a3551f405db83c2a9469fc235be3..ee500226197bc95bd0d30c274fddea18c5121944 100644 (file)
@@ -99,6 +99,7 @@ const struct fence_ops fence_array_ops = {
        .wait = fence_default_wait,
        .release = fence_array_release,
 };
+EXPORT_SYMBOL(fence_array_ops);
 
 /**
  * fence_array_create - Create a custom fence array
index 86baaa45567ce54d9499292bb2d0770c786e93ba..a44794e508df8cd3e72a8b3e37ad1a56a6107cd2 100644 (file)
@@ -51,6 +51,16 @@ struct fence_array {
 
 extern const struct fence_ops fence_array_ops;
 
+/**
+ * fence_is_array - check if a fence is from the array subsclass
+ *
+ * Return true if it is a fence_array and false otherwise.
+ */
+static inline bool fence_is_array(struct fence *fence)
+{
+       return fence->ops == &fence_array_ops;
+}
+
 /**
  * to_fence_array - cast a fence to a fence_array
  * @fence: fence to cast to a fence_array