diff mbox series

[1/2] dma-buf: Split out dma fence array create into alloc and arm

Message ID 20240826165456.2491477-2-matthew.brost@intel.com (mailing list archive)
State New
Headers show
Series Split out dma fence array and invalidate media_gt TLBs in PT code | expand

Commit Message

Matthew Brost Aug. 26, 2024, 4:54 p.m. UTC
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@linaro.org>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Matthew Brost <matthew.brost@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 mbox series

Patch

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,