[PATCH 1/2] dma-buf: Split out dma fence array create into alloc and arm
Matthew Brost
matthew.brost at intel.com
Mon Aug 26 16:54:55 UTC 2024
Useful to preallocate dma fence array and then arm in path of reclaim or
a dma fence.
v2:
- s/arm/init (Christian)
- Drop !array warn (Christian)
Cc: Sumit Semwal <sumit.semwal at linaro.org>
Cc: Christian König <christian.koenig at amd.com>
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
drivers/dma-buf/dma-fence-array.c | 19 +++++++++----------
include/linux/dma-fence-array.h | 9 ++++-----
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
index b03e0a87a5cd..0659e6b29b3c 100644
--- a/drivers/dma-buf/dma-fence-array.c
+++ b/drivers/dma-buf/dma-fence-array.c
@@ -158,7 +158,7 @@ struct dma_fence_array *dma_fence_array_alloc(int num_fences)
EXPORT_SYMBOL(dma_fence_array_alloc);
/**
- * dma_fence_array_arm - Arm a custom fence array
+ * dma_fence_array_init - Arm a custom fence array
* @array: [in] dma fence array to arm
* @num_fences: [in] number of fences to add in the array
* @fences: [in] array containing the fences
@@ -169,13 +169,12 @@ EXPORT_SYMBOL(dma_fence_array_alloc);
* Implementation of @dma_fence_array_create without allocation. Useful to arm a
* preallocated dma fence fence in the path of reclaim or dma fence signaling.
*/
-void dma_fence_array_arm(struct dma_fence_array *array,
- int num_fences,
- struct dma_fence **fences,
- u64 context, unsigned seqno,
- bool signal_on_any)
+void dma_fence_array_init(struct dma_fence_array *array,
+ int num_fences, struct dma_fence **fences,
+ u64 context, unsigned seqno,
+ bool signal_on_any)
{
- WARN_ON(!array || !num_fences || !fences);
+ WARN_ON(!num_fences || !fences);
array->num_fences = num_fences;
@@ -203,7 +202,7 @@ void dma_fence_array_arm(struct dma_fence_array *array,
while (num_fences--)
WARN_ON(dma_fence_is_container(fences[num_fences]));
}
-EXPORT_SYMBOL(dma_fence_array_arm);
+EXPORT_SYMBOL(dma_fence_array_init);
/**
* dma_fence_array_create - Create a custom fence array
@@ -235,8 +234,8 @@ struct dma_fence_array *dma_fence_array_create(int num_fences,
if (!array)
return NULL;
- dma_fence_array_arm(array, num_fences, fences,
- context, seqno, signal_on_any);
+ dma_fence_array_init(array, num_fences, fences,
+ context, seqno, signal_on_any);
return array;
}
diff --git a/include/linux/dma-fence-array.h b/include/linux/dma-fence-array.h
index 3466ffc4b803..079b3dec0a16 100644
--- a/include/linux/dma-fence-array.h
+++ b/include/linux/dma-fence-array.h
@@ -80,11 +80,10 @@ to_dma_fence_array(struct dma_fence *fence)
++(index), fence = dma_fence_array_next(head, index))
struct dma_fence_array *dma_fence_array_alloc(int num_fences);
-void dma_fence_array_arm(struct dma_fence_array *array,
- int num_fences,
- struct dma_fence **fences,
- u64 context, unsigned seqno,
- bool signal_on_any);
+void dma_fence_array_init(struct dma_fence_array *array,
+ int num_fences, struct dma_fence **fences,
+ u64 context, unsigned seqno,
+ bool signal_on_any);
struct dma_fence_array *dma_fence_array_create(int num_fences,
struct dma_fence **fences,
--
2.34.1
More information about the dri-devel
mailing list