[CI 03/12] dma-fence: Add callback transfer helper
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Tue Feb 14 09:32:30 UTC 2023
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
...
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
drivers/dma-buf/dma-fence.c | 16 ++++++++++++++++
include/linux/dma-fence.h | 4 ++++
2 files changed, 20 insertions(+)
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index ea4a1f82c9bf..3d254ddef516 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -977,3 +977,19 @@ dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops,
trace_dma_fence_init(fence);
}
EXPORT_SYMBOL(dma_fence_init);
+
+void
+__dma_fence_cb_transfer(struct dma_fence *from,
+ struct dma_fence_cb *cb,
+ struct dma_fence *to)
+{
+ lockdep_assert_held(to->lock);
+
+ if (from) {
+ lockdep_assert_held(from->lock);
+ list_move_tail(&cb->node, &to->cb_list);
+ } else {
+ list_add_tail(&cb->node, &to->cb_list);
+ }
+}
+EXPORT_SYMBOL(__dma_fence_cb_transfer);
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 35933e0ae62c..00e54ed61b2c 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -636,4 +636,8 @@ static inline void __dma_fence_cb_init(struct dma_fence_cb *cb,
cb->func = func;
}
+void __dma_fence_cb_transfer(struct dma_fence *from,
+ struct dma_fence_cb *cb,
+ struct dma_fence *to);
+
#endif /* __LINUX_DMA_FENCE_H */
--
2.34.1
More information about the Intel-gfx-trybot
mailing list