All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dma-buf: cleanup reservation_object_init/fini
@ 2019-06-27 10:18 Christian König
  2019-06-27 10:18 ` [PATCH 2/2] dma-buf: cleanup shared fence removal Christian König
  2019-06-27 15:38 ` [PATCH 1/2] dma-buf: cleanup reservation_object_init/fini Daniel Vetter
  0 siblings, 2 replies; 20+ messages in thread
From: Christian König @ 2019-06-27 10:18 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

They are not used that often and certainly not in a hot path.
Make them normal functions instead of an inline.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/dma-buf/reservation.c | 45 ++++++++++++++++++++++++++++++++++
 include/linux/reservation.h   | 46 ++---------------------------------
 2 files changed, 47 insertions(+), 44 deletions(-)

diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index 4d32e2c67862..ef710effedfa 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -55,6 +55,51 @@ EXPORT_SYMBOL(reservation_seqcount_class);
 const char reservation_seqcount_string[] = "reservation_seqcount";
 EXPORT_SYMBOL(reservation_seqcount_string);
 
+/**
+ * reservation_object_init - initialize a reservation object
+ * @obj: the reservation object
+ */
+void reservation_object_init(struct reservation_object *obj)
+{
+	ww_mutex_init(&obj->lock, &reservation_ww_class);
+
+	__seqcount_init(&obj->seq, reservation_seqcount_string,
+			&reservation_seqcount_class);
+	RCU_INIT_POINTER(obj->fence, NULL);
+	RCU_INIT_POINTER(obj->fence_excl, NULL);
+}
+EXPORT_SYMBOL(reservation_object_init);
+
+/**
+ * reservation_object_fini - destroys a reservation object
+ * @obj: the reservation object
+ */
+void reservation_object_fini(struct reservation_object *obj)
+{
+	int i;
+	struct reservation_object_list *fobj;
+	struct dma_fence *excl;
+
+	/*
+	 * This object should be dead and all references must have
+	 * been released to it, so no need to be protected with rcu.
+	 */
+	excl = rcu_dereference_protected(obj->fence_excl, 1);
+	if (excl)
+		dma_fence_put(excl);
+
+	fobj = rcu_dereference_protected(obj->fence, 1);
+	if (fobj) {
+		for (i = 0; i < fobj->shared_count; ++i)
+			dma_fence_put(rcu_dereference_protected(fobj->shared[i], 1));
+
+		kfree(fobj);
+	}
+
+	ww_mutex_destroy(&obj->lock);
+}
+EXPORT_SYMBOL(reservation_object_fini);
+
 /**
  * reservation_object_reserve_shared - Reserve space to add shared fences to
  * a reservation_object.
diff --git a/include/linux/reservation.h b/include/linux/reservation.h
index ee750765cc94..f47e8196d039 100644
--- a/include/linux/reservation.h
+++ b/include/linux/reservation.h
@@ -81,50 +81,6 @@ struct reservation_object {
 #define reservation_object_assert_held(obj) \
 	lockdep_assert_held(&(obj)->lock.base)
 
-/**
- * reservation_object_init - initialize a reservation object
- * @obj: the reservation object
- */
-static inline void
-reservation_object_init(struct reservation_object *obj)
-{
-	ww_mutex_init(&obj->lock, &reservation_ww_class);
-
-	__seqcount_init(&obj->seq, reservation_seqcount_string, &reservation_seqcount_class);
-	RCU_INIT_POINTER(obj->fence, NULL);
-	RCU_INIT_POINTER(obj->fence_excl, NULL);
-}
-
-/**
- * reservation_object_fini - destroys a reservation object
- * @obj: the reservation object
- */
-static inline void
-reservation_object_fini(struct reservation_object *obj)
-{
-	int i;
-	struct reservation_object_list *fobj;
-	struct dma_fence *excl;
-
-	/*
-	 * This object should be dead and all references must have
-	 * been released to it, so no need to be protected with rcu.
-	 */
-	excl = rcu_dereference_protected(obj->fence_excl, 1);
-	if (excl)
-		dma_fence_put(excl);
-
-	fobj = rcu_dereference_protected(obj->fence, 1);
-	if (fobj) {
-		for (i = 0; i < fobj->shared_count; ++i)
-			dma_fence_put(rcu_dereference_protected(fobj->shared[i], 1));
-
-		kfree(fobj);
-	}
-
-	ww_mutex_destroy(&obj->lock);
-}
-
 /**
  * reservation_object_get_list - get the reservation object's
  * shared fence list, with update-side lock held
@@ -267,6 +223,8 @@ reservation_object_get_excl_rcu(struct reservation_object *obj)
 	return fence;
 }
 
+void reservation_object_init(struct reservation_object *obj);
+void reservation_object_fini(struct reservation_object *obj);
 int reservation_object_reserve_shared(struct reservation_object *obj,
 				      unsigned int num_fences);
 void reservation_object_add_shared_fence(struct reservation_object *obj,
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-07-02 13:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 10:18 [PATCH 1/2] dma-buf: cleanup reservation_object_init/fini Christian König
2019-06-27 10:18 ` [PATCH 2/2] dma-buf: cleanup shared fence removal Christian König
2019-06-27 10:43   ` Daniel Vetter
2019-06-27 13:19     ` Christian König
     [not found]       ` <f1a792c2-87e0-9aba-c6f1-0374122d025b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-06-27 15:34         ` Daniel Vetter
     [not found]           ` <CAKMK7uFoeugD0ASHm4DRLzq6h3aAvNhE1ODh-bxoH7Lucf1m3w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-27 15:48             ` Koenig, Christian
2019-06-27 17:10               ` Daniel Vetter
     [not found]                 ` <20190627171053.GN12905-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-06-27 17:20                   ` Koenig, Christian
     [not found]                     ` <4844af2e-fbff-ceb9-c16e-32bb7012559f-5C7GfCeVMHo@public.gmane.org>
2019-06-27 19:57                       ` Daniel Vetter
     [not found]                         ` <CAKMK7uF2Wb_K9MqALs8o_2i+HDhv=JcnHj6t4VAUO80UVpszZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-28  6:32                           ` Koenig, Christian
2019-06-28  7:30                             ` Daniel Vetter
     [not found]                               ` <CAKMK7uFMZLemYkWTyOH_0akUbE53X44Xj7jky90G-jWtwSUicw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-28  8:40                                 ` Christian König
2019-06-28  9:41                                   ` Daniel Vetter
     [not found]                                     ` <CAKMK7uG-5e_V1OmWJKyHLGLXhBbex1LCVV7cdWjAgLSk-kTozA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-28 10:24                                       ` Koenig, Christian
2019-06-28 14:38                                         ` Daniel Vetter
     [not found]                                           ` <CAKMK7uFDKDhJQ05b6yb8Srz5E=YkzL+PGTZTYZX-b5dmWrwBVQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-28 15:21                                             ` Koenig, Christian
     [not found]                                               ` <af333288-9804-30e4-28ef-fda4c18b4a5d-5C7GfCeVMHo@public.gmane.org>
2019-06-28 16:40                                                 ` Daniel Vetter
2019-06-28 17:32                                                   ` Koenig, Christian
     [not found]                                                     ` <060a49d3-7196-1440-db93-4a19c9170f1b-5C7GfCeVMHo@public.gmane.org>
2019-07-02 13:50                                                       ` Daniel Vetter
2019-06-27 15:38 ` [PATCH 1/2] dma-buf: cleanup reservation_object_init/fini Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.