[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1452869739-3304-29-git-send-email-gustavo@padovan.org>
Date: Fri, 15 Jan 2016 12:55:38 -0200
From: Gustavo Padovan <gustavo@...ovan.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
dri-devel@...ts.freedesktop.org, daniels@...labora.com,
Arve Hjønnevåg <arve@...roid.com>,
Riley Andrews <riandrews@...roid.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Rob Clark <robdclark@...il.com>,
Greg Hackmann <ghackmann@...gle.com>,
John Harrison <John.C.Harrison@...el.com>,
Maarten Lankhorst <maarten.lankhorst@...onical.com>,
Gustavo Padovan <gustavo.padovan@...labora.co.uk>
Subject: [RFC 28/29] staging/android: use .cleanup() to interrupt any sync_fence waiter
From: Gustavo Padovan <gustavo.padovan@...labora.co.uk>
When the timeline is being destroyed all the waiters waiting for the
sync_fence to signal need to be woken up and finished as well.
Signed-off-by: Gustavo Padovan <gustavo.padovan@...labora.co.uk>
---
drivers/staging/android/sw_sync.c | 8 ++++++++
drivers/staging/android/sync.c | 9 +++++++++
drivers/staging/android/sync.h | 2 ++
3 files changed, 19 insertions(+)
diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index ee7a942..8c83bad 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -25,6 +25,13 @@
#include "sw_sync.h"
+static void sw_sync_cleanup(struct fence *fence, void *user_data)
+{
+ struct sync_fence *sync_fence = user_data;
+
+ sync_fence_cleanup(sync_fence);
+}
+
static const struct fence_ops sw_sync_fence_ops = {
.get_driver_name = fence_default_get_driver_name,
.get_timeline_name = fence_default_get_timeline_name,
@@ -32,6 +39,7 @@ static const struct fence_ops sw_sync_fence_ops = {
.signaled = fence_default_signaled,
.wait = fence_default_wait,
.release = fence_default_release,
+ .cleanup = sw_sync_cleanup,
.fill_driver_data = fence_default_fill_driver_data,
.fence_value_str = fence_default_value_str,
.timeline_value_str = fence_default_timeline_value_str,
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 956b4e9..aafecf4 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -91,6 +91,8 @@ struct sync_fence *sync_fence_create_dma(const char *name, struct fence *fence)
sync_fence_debug_add(sync_fence);
+ fence_add_user_data(fence, sync_fence);
+
return sync_fence;
}
EXPORT_SYMBOL(sync_fence_create_dma);
@@ -101,6 +103,13 @@ struct sync_fence *sync_fence_create(const char *name, struct fence *fence)
}
EXPORT_SYMBOL(sync_fence_create);
+void sync_fence_cleanup(struct sync_fence *sync_fence)
+{
+ atomic_set(&sync_fence->status, -ENOENT);
+ wake_up_all(&sync_fence->wq);
+}
+EXPORT_SYMBOL(sync_fence_cleanup);
+
struct sync_fence *sync_fence_fdget(int fd)
{
struct file *file = fget(fd);
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 8e6827b..d60d9c2 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -98,6 +98,8 @@ struct sync_fence *sync_fence_create(const char *name, struct fence *fence);
*/
struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt);
+void sync_fence_cleanup(struct sync_fence *sync_fence);
+
/*
* API for sync_fence consumers
*/
--
2.5.0
Powered by blists - more mailing lists