All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	dri-devel@lists.freedesktop.org, daniels@collabora.com,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Rob Clark" <robdclark@gmail.com>,
	"Greg Hackmann" <ghackmann@google.com>,
	"John Harrison" <John.C.Harrison@Intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@canonical.com>,
	"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>
Subject: [RFC 12/29] staging/android: remove struct sync_pt
Date: Fri, 15 Jan 2016 12:55:22 -0200	[thread overview]
Message-ID: <1452869739-3304-13-git-send-email-gustavo@padovan.org> (raw)
In-Reply-To: <1452869739-3304-1-git-send-email-gustavo@padovan.org>

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

struct sync_pt was just wrapping around struct fence and creating an
extra abstraction layer. The only two members of struct sync_pt, child_list
and active_list, were moved to struct fence in an earlier commit. After
removing those two members struct sync_pt is nothing more than struct
fence, so remove it all and use struct fence directly.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sw_sync.c    |  7 +++---
 drivers/staging/android/sw_sync.h    |  8 +++----
 drivers/staging/android/sync.c       | 33 ++++++++++++-----------------
 drivers/staging/android/sync.h       | 21 ++++--------------
 drivers/staging/android/sync_debug.c | 41 ++++++++++++++++++------------------
 drivers/staging/android/trace/sync.h | 14 ++++++------
 6 files changed, 53 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index 98f9a29..9d6a5bd 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -25,7 +25,7 @@
 
 #include "sw_sync.h"
 
-struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
+struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
 {
 	struct sw_sync_pt *pt;
 
@@ -34,7 +34,7 @@ struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
 
 	pt->value = value;
 
-	return (struct sync_pt *)pt;
+	return (struct fence *)pt;
 }
 EXPORT_SYMBOL(sw_sync_pt_create);
 
@@ -50,8 +50,7 @@ static int sw_sync_fence_has_signaled(struct fence *fence)
 static int sw_sync_fill_driver_data(struct fence *fence,
 				    void *data, int size)
 {
-	struct sync_pt *sync_pt = (struct sync_pt *)fence;
-	struct sw_sync_pt *pt = (struct sw_sync_pt *)sync_pt;
+	struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
 
 	if (size < sizeof(pt->value))
 		return -ENOMEM;
diff --git a/drivers/staging/android/sw_sync.h b/drivers/staging/android/sw_sync.h
index cb62298..85ef780 100644
--- a/drivers/staging/android/sw_sync.h
+++ b/drivers/staging/android/sw_sync.h
@@ -29,7 +29,7 @@ struct sw_sync_timeline {
 };
 
 struct sw_sync_pt {
-	struct sync_pt		pt;
+	struct fence		pt;
 
 	u32			value;
 };
@@ -38,7 +38,7 @@ struct sw_sync_pt {
 struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
 void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
 
-struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
+struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
 #else
 static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
 {
@@ -49,8 +49,8 @@ static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
 {
 }
 
-static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj,
-						u32 value)
+static inline struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj,
+					      u32 value)
 {
 	return NULL;
 }
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index b07bc24..417cf9f 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -39,7 +39,7 @@ struct fence *sync_pt_create(struct fence_timeline *obj, int size)
 	unsigned long flags;
 	struct fence *fence;
 
-	if (size < sizeof(struct sync_pt))
+	if (size < sizeof(*fence))
 		return NULL;
 
 	fence = kzalloc(size, GFP_KERNEL);
@@ -57,12 +57,6 @@ struct fence *sync_pt_create(struct fence_timeline *obj, int size)
 }
 EXPORT_SYMBOL(sync_pt_create);
 
-void sync_pt_free(struct sync_pt *pt)
-{
-	fence_put(&pt->base);
-}
-EXPORT_SYMBOL(sync_pt_free);
-
 static struct sync_fence *sync_fence_alloc(int size, const char *name)
 {
 	struct sync_fence *sync_fence;
@@ -101,7 +95,7 @@ static void fence_check_cb_func(struct fence *f, struct fence_cb *cb)
 }
 
 /* TODO: implement a create which takes more that one sync_pt */
-struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt)
+struct sync_fence *sync_fence_create_dma(const char *name, struct fence *fence)
 {
 	struct sync_fence *sync_fence;
 
@@ -113,9 +107,10 @@ struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt)
 	sync_fence->num_fences = 1;
 	atomic_set(&sync_fence->status, 1);
 
-	sync_fence->cbs[0].fence = pt;
+	sync_fence->cbs[0].fence = fence;
 	sync_fence->cbs[0].sync_fence = sync_fence;
-	if (fence_add_callback(pt, &sync_fence->cbs[0].cb, fence_check_cb_func))
+	if (fence_add_callback(fence, &sync_fence->cbs[0].cb,
+			       fence_check_cb_func))
 		atomic_dec(&sync_fence->status);
 
 	sync_fence_debug_add(sync_fence);
@@ -124,9 +119,9 @@ struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt)
 }
 EXPORT_SYMBOL(sync_fence_create_dma);
 
-struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt)
+struct sync_fence *sync_fence_create(const char *name, struct fence *fence)
 {
-	return sync_fence_create_dma(name, &pt->base);
+	return sync_fence_create_dma(name, fence);
 }
 EXPORT_SYMBOL(sync_fence_create);
 
@@ -161,14 +156,14 @@ void sync_fence_install(struct sync_fence *sync_fence, int fd)
 EXPORT_SYMBOL(sync_fence_install);
 
 static void sync_fence_add_pt(struct sync_fence *sync_fence,
-			      int *i, struct fence *pt)
+			      int *i, struct fence *fence)
 {
-	sync_fence->cbs[*i].fence = pt;
+	sync_fence->cbs[*i].fence = fence;
 	sync_fence->cbs[*i].sync_fence = sync_fence;
 
-	if (!fence_add_callback(pt, &sync_fence->cbs[*i].cb,
+	if (!fence_add_callback(fence, &sync_fence->cbs[*i].cb,
 				fence_check_cb_func)) {
-		fence_get(pt);
+		fence_get(fence);
 		(*i)++;
 	}
 }
@@ -300,7 +295,7 @@ int sync_fence_wait(struct sync_fence *sync_fence, long timeout)
 
 	trace_sync_wait(sync_fence, 1);
 	for (i = 0; i < sync_fence->num_fences; ++i)
-		trace_sync_pt(sync_fence->cbs[i].fence);
+		trace_fence(sync_fence->cbs[i].fence);
 	ret = wait_event_interruptible_timeout(sync_fence->wq,
 					       atomic_read(&sync_fence->status) <= 0,
 					       timeout);
@@ -589,9 +584,9 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *sync_fence,
 	len = sizeof(struct sync_fence_info_data);
 
 	for (i = 0; i < sync_fence->num_fences; ++i) {
-		struct fence *pt = sync_fence->cbs[i].fence;
+		struct fence *fence = sync_fence->cbs[i].fence;
 
-		ret = sync_fill_pt_info(pt, (u8 *)data + len, size - len);
+		ret = sync_fill_pt_info(fence, (u8 *)data + len, size - len);
 
 		if (ret < 0)
 			goto out;
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 53658cc..e011111 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -25,10 +25,6 @@
 
 struct sync_fence;
 
-struct sync_pt {
-	struct fence base;
-};
-
 struct sync_fence_cb {
 	struct fence_cb cb;
 	struct fence *fence;
@@ -89,23 +85,14 @@ static inline void sync_fence_waiter_init(struct sync_fence_waiter *waiter,
 struct fence *sync_pt_create(struct fence_timeline *parent, int size);
 
 /**
- * sync_pt_free() - frees a sync pt
- * @pt:		sync_pt to free
- *
- * This should only be called on sync_pts which have been created but
- * not added to a fence.
- */
-void sync_pt_free(struct sync_pt *pt);
-
-/**
  * sync_fence_create() - creates a sync fence
  * @name:	name of fence to create
- * @pt:		sync_pt to add to the fence
+ * @fence:	fence to add to the sync_fence
  *
- * Creates a fence containg @pt.  Once this is called, the fence takes
- * ownership of @pt.
+ * Creates a fence containg @fence.  Once this is called, the fence takes
+ * ownership of @fence.
  */
-struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt);
+struct sync_fence *sync_fence_create(const char *name, struct fence *fence);
 
 /**
  * sync_fence_create_dma() - creates a sync fence from dma-fence
diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
index f5fd8c3..b8602d2 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -85,39 +85,40 @@ static const char *sync_status_str(int status)
 	return "error";
 }
 
-static void sync_print_pt(struct seq_file *s, struct fence *pt, bool fence)
+static void sync_print_fence(struct seq_file *s, struct fence *fence, bool show)
 {
 	int status = 1;
+	struct fence_timeline *parent = fence_parent(fence);
 
-	if (fence_is_signaled_locked(pt))
-		status = pt->status;
+	if (fence_is_signaled_locked(fence))
+		status = fence->status;
 
-	seq_printf(s, "  %s%spt %s",
-		   fence && pt->ops->get_timeline_name ?
-		   pt->ops->get_timeline_name(pt) : "",
-		   fence ? "_" : "",
+	seq_printf(s, "  %s%sfence %s",
+		   show ? parent->name : "",
+		   show ? "_" : "",
 		   sync_status_str(status));
 
 	if (status <= 0) {
 		struct timespec64 ts64 =
-			ktime_to_timespec64(pt->timestamp);
+			ktime_to_timespec64(fence->timestamp);
 
 		seq_printf(s, "@%lld.%09ld", (s64)ts64.tv_sec, ts64.tv_nsec);
 	}
 
-	if ((!fence || pt->ops->timeline_value_str) &&
-	    pt->ops->fence_value_str) {
+	if ((!fence || fence->ops->timeline_value_str) &&
+		fence->ops->fence_value_str) {
 		char value[64];
 		bool success;
 
-		pt->ops->fence_value_str(pt, value, sizeof(value));
+		fence->ops->fence_value_str(fence, value, sizeof(value));
 		success = strlen(value);
 
 		if (success)
 			seq_printf(s, ": %s", value);
 
 		if (success && fence) {
-			pt->ops->timeline_value_str(pt, value, sizeof(value));
+			fence->ops->timeline_value_str(fence, value,
+						       sizeof(value));
 
 			if (strlen(value))
 				seq_printf(s, " / %s", value);
@@ -145,9 +146,9 @@ static void sync_print_obj(struct seq_file *s, struct fence_timeline *obj)
 
 	spin_lock_irqsave(&obj->lock, flags);
 	list_for_each(pos, &obj->child_list_head) {
-		struct sync_pt *pt = (struct sync_pt *)
+		struct fence *fence =
 			container_of(pos, struct fence, child_list);
-		sync_print_pt(s, &pt->base, false);
+		sync_print_fence(s, fence, false);
 	}
 	spin_unlock_irqrestore(&obj->lock, flags);
 }
@@ -163,7 +164,7 @@ static void sync_print_sync_fence(struct seq_file *s,
 		   sync_status_str(atomic_read(&sync_fence->status)));
 
 	for (i = 0; i < sync_fence->num_fences; ++i) {
-		sync_print_pt(s, sync_fence->cbs[i].fence, true);
+		sync_print_fence(s, sync_fence->cbs[i].fence, true);
 	}
 
 	spin_lock_irqsave(&sync_fence->wq.lock, flags);
@@ -260,7 +261,7 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
 {
 	int fd = get_unused_fd_flags(O_CLOEXEC);
 	int err;
-	struct sync_pt *pt;
+	struct fence *fence;
 	struct sync_fence *sync_fence;
 	struct sw_sync_create_fence_data data;
 
@@ -272,16 +273,16 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
 		goto err;
 	}
 
-	pt = sw_sync_pt_create(obj, data.value);
-	if (!pt) {
+	fence = sw_sync_pt_create(obj, data.value);
+	if (!fence) {
 		err = -ENOMEM;
 		goto err;
 	}
 
 	data.name[sizeof(data.name) - 1] = '\0';
-	sync_fence = sync_fence_create(data.name, pt);
+	sync_fence = sync_fence_create(data.name, fence);
 	if (!sync_fence) {
-		sync_pt_free(pt);
+		fence_put(fence);
 		err = -ENOMEM;
 		goto err;
 	}
diff --git a/drivers/staging/android/trace/sync.h b/drivers/staging/android/trace/sync.h
index 59c337f..4f68515 100644
--- a/drivers/staging/android/trace/sync.h
+++ b/drivers/staging/android/trace/sync.h
@@ -29,20 +29,20 @@ TRACE_EVENT(sync_wait,
 			__get_str(name), __entry->status)
 );
 
-TRACE_EVENT(sync_pt,
-	TP_PROTO(struct fence *pt),
+TRACE_EVENT(fence,
+	TP_PROTO(struct fence *fence),
 
-	TP_ARGS(pt),
+	TP_ARGS(fence),
 
 	TP_STRUCT__entry(
-		__string(timeline, pt->ops->get_timeline_name(pt))
+		__string(timeline, fence->ops->get_timeline_name(fence))
 		__array(char, value, 32)
 	),
 
 	TP_fast_assign(
-		__assign_str(timeline, pt->ops->get_timeline_name(pt));
-		if (pt->ops->fence_value_str) {
-			pt->ops->fence_value_str(pt, __entry->value,
+		__assign_str(timeline, fence->ops->get_timeline_name(fence));
+		if (fence->ops->fence_value_str) {
+			fence->ops->fence_value_str(fence, __entry->value,
 							sizeof(__entry->value));
 		} else {
 			__entry->value[0] = '\0';
-- 
2.5.0

WARNING: multiple messages have this Message-ID (diff)
From: Gustavo Padovan <gustavo@padovan.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org, daniels@collabora.com,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Riley Andrews" <riandrews@android.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	"Arve Hjønnevåg" <arve@android.com>,
	"Maarten Lankhorst" <maarten.lankhorst@canonical.com>,
	"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>,
	"John Harrison" <John.C.Harrison@Intel.com>
Subject: [RFC 12/29] staging/android: remove struct sync_pt
Date: Fri, 15 Jan 2016 12:55:22 -0200	[thread overview]
Message-ID: <1452869739-3304-13-git-send-email-gustavo@padovan.org> (raw)
In-Reply-To: <1452869739-3304-1-git-send-email-gustavo@padovan.org>

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

struct sync_pt was just wrapping around struct fence and creating an
extra abstraction layer. The only two members of struct sync_pt, child_list
and active_list, were moved to struct fence in an earlier commit. After
removing those two members struct sync_pt is nothing more than struct
fence, so remove it all and use struct fence directly.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/staging/android/sw_sync.c    |  7 +++---
 drivers/staging/android/sw_sync.h    |  8 +++----
 drivers/staging/android/sync.c       | 33 ++++++++++++-----------------
 drivers/staging/android/sync.h       | 21 ++++--------------
 drivers/staging/android/sync_debug.c | 41 ++++++++++++++++++------------------
 drivers/staging/android/trace/sync.h | 14 ++++++------
 6 files changed, 53 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index 98f9a29..9d6a5bd 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -25,7 +25,7 @@
 
 #include "sw_sync.h"
 
-struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
+struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
 {
 	struct sw_sync_pt *pt;
 
@@ -34,7 +34,7 @@ struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
 
 	pt->value = value;
 
-	return (struct sync_pt *)pt;
+	return (struct fence *)pt;
 }
 EXPORT_SYMBOL(sw_sync_pt_create);
 
@@ -50,8 +50,7 @@ static int sw_sync_fence_has_signaled(struct fence *fence)
 static int sw_sync_fill_driver_data(struct fence *fence,
 				    void *data, int size)
 {
-	struct sync_pt *sync_pt = (struct sync_pt *)fence;
-	struct sw_sync_pt *pt = (struct sw_sync_pt *)sync_pt;
+	struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
 
 	if (size < sizeof(pt->value))
 		return -ENOMEM;
diff --git a/drivers/staging/android/sw_sync.h b/drivers/staging/android/sw_sync.h
index cb62298..85ef780 100644
--- a/drivers/staging/android/sw_sync.h
+++ b/drivers/staging/android/sw_sync.h
@@ -29,7 +29,7 @@ struct sw_sync_timeline {
 };
 
 struct sw_sync_pt {
-	struct sync_pt		pt;
+	struct fence		pt;
 
 	u32			value;
 };
@@ -38,7 +38,7 @@ struct sw_sync_pt {
 struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
 void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
 
-struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
+struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
 #else
 static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
 {
@@ -49,8 +49,8 @@ static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
 {
 }
 
-static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj,
-						u32 value)
+static inline struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj,
+					      u32 value)
 {
 	return NULL;
 }
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index b07bc24..417cf9f 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -39,7 +39,7 @@ struct fence *sync_pt_create(struct fence_timeline *obj, int size)
 	unsigned long flags;
 	struct fence *fence;
 
-	if (size < sizeof(struct sync_pt))
+	if (size < sizeof(*fence))
 		return NULL;
 
 	fence = kzalloc(size, GFP_KERNEL);
@@ -57,12 +57,6 @@ struct fence *sync_pt_create(struct fence_timeline *obj, int size)
 }
 EXPORT_SYMBOL(sync_pt_create);
 
-void sync_pt_free(struct sync_pt *pt)
-{
-	fence_put(&pt->base);
-}
-EXPORT_SYMBOL(sync_pt_free);
-
 static struct sync_fence *sync_fence_alloc(int size, const char *name)
 {
 	struct sync_fence *sync_fence;
@@ -101,7 +95,7 @@ static void fence_check_cb_func(struct fence *f, struct fence_cb *cb)
 }
 
 /* TODO: implement a create which takes more that one sync_pt */
-struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt)
+struct sync_fence *sync_fence_create_dma(const char *name, struct fence *fence)
 {
 	struct sync_fence *sync_fence;
 
@@ -113,9 +107,10 @@ struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt)
 	sync_fence->num_fences = 1;
 	atomic_set(&sync_fence->status, 1);
 
-	sync_fence->cbs[0].fence = pt;
+	sync_fence->cbs[0].fence = fence;
 	sync_fence->cbs[0].sync_fence = sync_fence;
-	if (fence_add_callback(pt, &sync_fence->cbs[0].cb, fence_check_cb_func))
+	if (fence_add_callback(fence, &sync_fence->cbs[0].cb,
+			       fence_check_cb_func))
 		atomic_dec(&sync_fence->status);
 
 	sync_fence_debug_add(sync_fence);
@@ -124,9 +119,9 @@ struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt)
 }
 EXPORT_SYMBOL(sync_fence_create_dma);
 
-struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt)
+struct sync_fence *sync_fence_create(const char *name, struct fence *fence)
 {
-	return sync_fence_create_dma(name, &pt->base);
+	return sync_fence_create_dma(name, fence);
 }
 EXPORT_SYMBOL(sync_fence_create);
 
@@ -161,14 +156,14 @@ void sync_fence_install(struct sync_fence *sync_fence, int fd)
 EXPORT_SYMBOL(sync_fence_install);
 
 static void sync_fence_add_pt(struct sync_fence *sync_fence,
-			      int *i, struct fence *pt)
+			      int *i, struct fence *fence)
 {
-	sync_fence->cbs[*i].fence = pt;
+	sync_fence->cbs[*i].fence = fence;
 	sync_fence->cbs[*i].sync_fence = sync_fence;
 
-	if (!fence_add_callback(pt, &sync_fence->cbs[*i].cb,
+	if (!fence_add_callback(fence, &sync_fence->cbs[*i].cb,
 				fence_check_cb_func)) {
-		fence_get(pt);
+		fence_get(fence);
 		(*i)++;
 	}
 }
@@ -300,7 +295,7 @@ int sync_fence_wait(struct sync_fence *sync_fence, long timeout)
 
 	trace_sync_wait(sync_fence, 1);
 	for (i = 0; i < sync_fence->num_fences; ++i)
-		trace_sync_pt(sync_fence->cbs[i].fence);
+		trace_fence(sync_fence->cbs[i].fence);
 	ret = wait_event_interruptible_timeout(sync_fence->wq,
 					       atomic_read(&sync_fence->status) <= 0,
 					       timeout);
@@ -589,9 +584,9 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *sync_fence,
 	len = sizeof(struct sync_fence_info_data);
 
 	for (i = 0; i < sync_fence->num_fences; ++i) {
-		struct fence *pt = sync_fence->cbs[i].fence;
+		struct fence *fence = sync_fence->cbs[i].fence;
 
-		ret = sync_fill_pt_info(pt, (u8 *)data + len, size - len);
+		ret = sync_fill_pt_info(fence, (u8 *)data + len, size - len);
 
 		if (ret < 0)
 			goto out;
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 53658cc..e011111 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -25,10 +25,6 @@
 
 struct sync_fence;
 
-struct sync_pt {
-	struct fence base;
-};
-
 struct sync_fence_cb {
 	struct fence_cb cb;
 	struct fence *fence;
@@ -89,23 +85,14 @@ static inline void sync_fence_waiter_init(struct sync_fence_waiter *waiter,
 struct fence *sync_pt_create(struct fence_timeline *parent, int size);
 
 /**
- * sync_pt_free() - frees a sync pt
- * @pt:		sync_pt to free
- *
- * This should only be called on sync_pts which have been created but
- * not added to a fence.
- */
-void sync_pt_free(struct sync_pt *pt);
-
-/**
  * sync_fence_create() - creates a sync fence
  * @name:	name of fence to create
- * @pt:		sync_pt to add to the fence
+ * @fence:	fence to add to the sync_fence
  *
- * Creates a fence containg @pt.  Once this is called, the fence takes
- * ownership of @pt.
+ * Creates a fence containg @fence.  Once this is called, the fence takes
+ * ownership of @fence.
  */
-struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt);
+struct sync_fence *sync_fence_create(const char *name, struct fence *fence);
 
 /**
  * sync_fence_create_dma() - creates a sync fence from dma-fence
diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
index f5fd8c3..b8602d2 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -85,39 +85,40 @@ static const char *sync_status_str(int status)
 	return "error";
 }
 
-static void sync_print_pt(struct seq_file *s, struct fence *pt, bool fence)
+static void sync_print_fence(struct seq_file *s, struct fence *fence, bool show)
 {
 	int status = 1;
+	struct fence_timeline *parent = fence_parent(fence);
 
-	if (fence_is_signaled_locked(pt))
-		status = pt->status;
+	if (fence_is_signaled_locked(fence))
+		status = fence->status;
 
-	seq_printf(s, "  %s%spt %s",
-		   fence && pt->ops->get_timeline_name ?
-		   pt->ops->get_timeline_name(pt) : "",
-		   fence ? "_" : "",
+	seq_printf(s, "  %s%sfence %s",
+		   show ? parent->name : "",
+		   show ? "_" : "",
 		   sync_status_str(status));
 
 	if (status <= 0) {
 		struct timespec64 ts64 =
-			ktime_to_timespec64(pt->timestamp);
+			ktime_to_timespec64(fence->timestamp);
 
 		seq_printf(s, "@%lld.%09ld", (s64)ts64.tv_sec, ts64.tv_nsec);
 	}
 
-	if ((!fence || pt->ops->timeline_value_str) &&
-	    pt->ops->fence_value_str) {
+	if ((!fence || fence->ops->timeline_value_str) &&
+		fence->ops->fence_value_str) {
 		char value[64];
 		bool success;
 
-		pt->ops->fence_value_str(pt, value, sizeof(value));
+		fence->ops->fence_value_str(fence, value, sizeof(value));
 		success = strlen(value);
 
 		if (success)
 			seq_printf(s, ": %s", value);
 
 		if (success && fence) {
-			pt->ops->timeline_value_str(pt, value, sizeof(value));
+			fence->ops->timeline_value_str(fence, value,
+						       sizeof(value));
 
 			if (strlen(value))
 				seq_printf(s, " / %s", value);
@@ -145,9 +146,9 @@ static void sync_print_obj(struct seq_file *s, struct fence_timeline *obj)
 
 	spin_lock_irqsave(&obj->lock, flags);
 	list_for_each(pos, &obj->child_list_head) {
-		struct sync_pt *pt = (struct sync_pt *)
+		struct fence *fence =
 			container_of(pos, struct fence, child_list);
-		sync_print_pt(s, &pt->base, false);
+		sync_print_fence(s, fence, false);
 	}
 	spin_unlock_irqrestore(&obj->lock, flags);
 }
@@ -163,7 +164,7 @@ static void sync_print_sync_fence(struct seq_file *s,
 		   sync_status_str(atomic_read(&sync_fence->status)));
 
 	for (i = 0; i < sync_fence->num_fences; ++i) {
-		sync_print_pt(s, sync_fence->cbs[i].fence, true);
+		sync_print_fence(s, sync_fence->cbs[i].fence, true);
 	}
 
 	spin_lock_irqsave(&sync_fence->wq.lock, flags);
@@ -260,7 +261,7 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
 {
 	int fd = get_unused_fd_flags(O_CLOEXEC);
 	int err;
-	struct sync_pt *pt;
+	struct fence *fence;
 	struct sync_fence *sync_fence;
 	struct sw_sync_create_fence_data data;
 
@@ -272,16 +273,16 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
 		goto err;
 	}
 
-	pt = sw_sync_pt_create(obj, data.value);
-	if (!pt) {
+	fence = sw_sync_pt_create(obj, data.value);
+	if (!fence) {
 		err = -ENOMEM;
 		goto err;
 	}
 
 	data.name[sizeof(data.name) - 1] = '\0';
-	sync_fence = sync_fence_create(data.name, pt);
+	sync_fence = sync_fence_create(data.name, fence);
 	if (!sync_fence) {
-		sync_pt_free(pt);
+		fence_put(fence);
 		err = -ENOMEM;
 		goto err;
 	}
diff --git a/drivers/staging/android/trace/sync.h b/drivers/staging/android/trace/sync.h
index 59c337f..4f68515 100644
--- a/drivers/staging/android/trace/sync.h
+++ b/drivers/staging/android/trace/sync.h
@@ -29,20 +29,20 @@ TRACE_EVENT(sync_wait,
 			__get_str(name), __entry->status)
 );
 
-TRACE_EVENT(sync_pt,
-	TP_PROTO(struct fence *pt),
+TRACE_EVENT(fence,
+	TP_PROTO(struct fence *fence),
 
-	TP_ARGS(pt),
+	TP_ARGS(fence),
 
 	TP_STRUCT__entry(
-		__string(timeline, pt->ops->get_timeline_name(pt))
+		__string(timeline, fence->ops->get_timeline_name(fence))
 		__array(char, value, 32)
 	),
 
 	TP_fast_assign(
-		__assign_str(timeline, pt->ops->get_timeline_name(pt));
-		if (pt->ops->fence_value_str) {
-			pt->ops->fence_value_str(pt, __entry->value,
+		__assign_str(timeline, fence->ops->get_timeline_name(fence));
+		if (fence->ops->fence_value_str) {
+			fence->ops->fence_value_str(fence, __entry->value,
 							sizeof(__entry->value));
 		} else {
 			__entry->value[0] = '\0';
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-01-15 14:56 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 14:55 [RFC 00/29] De-stage android's sync framework Gustavo Padovan
2016-01-15 14:55 ` [RFC 01/29] staging/android: fix sync framework documentation Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 02/29] staging/android: fix checkpatch warning Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 03/29] staging/android: rename sync_fence_release Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 04/29] staging/android: rename 'android_fence' to 'sync_fence' Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 05/29] staging/android: remove not used sync_timeline ops Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 06/29] staging/android: create a 'sync' dir for debugfs information Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 07/29] staging/android: move sw_sync file to debugfs file Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 08/29] staging/android: Remove WARN_ON_ONCE when releasing sync_fence Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 09/29] staging/android: rename struct sync_fence's variables to 'sync_fence' Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 10/29] staging/android: rename 'sync_pt' to 'fence' in struct sync_fence_cb Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 11/29] dma-buf/fence: move sync_timeline to fence_timeline Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-20  0:56   ` Greg Hackmann
2016-01-20  0:56     ` Greg Hackmann
2016-01-15 14:55 ` Gustavo Padovan [this message]
2016-01-15 14:55   ` [RFC 12/29] staging/android: remove struct sync_pt Gustavo Padovan
2016-01-15 14:55 ` [RFC 13/29] dma-buf/fence: create fence_default_enable_signaling() Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 14/29] dma-buf/fence: create fence_default_release() Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 15/29] dma-buf/fence: create fence_default_get_driver_name() Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 16/29] dma-buf/fence: create fence_default_timeline_name() Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 17/29] dma-buf/fence: store last signaled value on fence timeline Gustavo Padovan
2016-01-15 14:55 ` [RFC 18/29] dma-buf/fence: create default .fence_value_str() and .timeline_value_str() Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 19/29] dma-buf/fence: create fence_default_fill_driver_data() Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 20/29] dma-buf/fence: remove fence_timeline_ops Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 21/29] dma-buf/fence: add fence_create_on_timeline() Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 22/29] staging/android: remove sync_pt_create() Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 23/29] staging/android: remove sw_sync_timeline and sw_sync_pt Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 24/29] dma-buf/fence: add debug to fence timeline Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 25/29] dma-buf/fence: remove unused var from fence_timeline_signal() Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 26/29] dma-buf/fence: remove pointless fence_timeline_signal at destroy phase Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 17:48   ` John Harrison
2016-01-15 18:02     ` Gustavo Padovan
2016-01-15 23:42       ` Greg Hackmann
2016-01-15 23:42         ` Greg Hackmann
2016-02-09 22:55         ` Tom Cherry
2016-02-09 22:55           ` Tom Cherry
2016-02-25 15:26           ` Gustavo Padovan
2016-02-25 15:26             ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 27/29] dma-buf/fence: add .cleanup() callback Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 28/29] staging/android: use .cleanup() to interrupt any sync_fence waiter Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 14:55 ` [RFC 29/29] dma-buf/fence: de-stage sync framework Gustavo Padovan
2016-01-15 14:55   ` Gustavo Padovan
2016-01-15 19:11 ` [RFC 00/29] De-stage android's " Joe Perches
2016-01-19 11:00 ` Daniel Vetter
2016-01-19 11:00   ` Daniel Vetter
2016-01-19 15:23   ` Gustavo Padovan
2016-01-19 15:23     ` Gustavo Padovan
2016-01-19 16:12     ` John Harrison
2016-01-19 17:52       ` Gustavo Padovan
2016-01-19 17:52         ` Gustavo Padovan
2016-01-19 18:04         ` Daniel Vetter
2016-01-19 18:04           ` Daniel Vetter
2016-01-19 18:15           ` Gustavo Padovan
2016-03-23 15:07       ` Tomeu Vizoso
2016-03-23 15:07         ` Tomeu Vizoso
2016-01-19 20:10   ` Gustavo Padovan
2016-01-19 20:10     ` Gustavo Padovan
2016-01-19 20:32     ` Daniel Vetter
2016-01-19 20:32       ` Daniel Vetter
2016-01-20 10:28 ` Maarten Lankhorst
2016-01-20 14:32   ` Gustavo Padovan
2016-01-20 14:32     ` Gustavo Padovan
2016-01-20 15:02     ` Maarten Lankhorst
2016-01-20 15:02       ` Maarten Lankhorst
2016-01-20 16:29       ` Daniel Vetter
2016-01-20 16:29         ` Daniel Vetter
2016-01-20 18:28       ` Gustavo Padovan
2016-01-20 18:28         ` Gustavo Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452869739-3304-13-git-send-email-gustavo@padovan.org \
    --to=gustavo@padovan.org \
    --cc=John.C.Harrison@Intel.com \
    --cc=arve@android.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniels@collabora.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ghackmann@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@canonical.com \
    --cc=riandrews@android.com \
    --cc=robdclark@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.