[RFC 16/29] dma-buf/fence: create fence_default_timeline_name()
From: Gustavo Padovan
Date: Fri Jan 15 2016 - 09:56:51 EST
From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
The fence timeline struct already receives the name of the timeline so
we can use a default function to return the timeline name.
Signed-off-by: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
---
drivers/dma-buf/fence.c | 14 ++++++++++++++
drivers/staging/android/sync.c | 9 +--------
include/linux/fence.h | 1 +
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c
index 85b5074..f77d6a9 100644
--- a/drivers/dma-buf/fence.c
+++ b/drivers/dma-buf/fence.c
@@ -456,6 +456,20 @@ const char *fence_default_get_driver_name(struct fence *fence)
EXPORT_SYMBOL(fence_default_get_driver_name);
/**
+ * fence_default_get_timeline_name - default get_timeline_name op
+ * @fence: [in] the fence to retrieve timeline name
+ *
+ * This function returns the name of the timeline which the fence belongs to.
+ */
+const char *fence_default_get_timeline_name(struct fence *fence)
+{
+ struct fence_timeline *parent = fence_parent(fence);
+
+ return parent->name;
+}
+EXPORT_SYMBOL(fence_default_get_timeline_name);
+
+/**
* fence_default_enable_signaling - default op for .enable_signaling
* @fence: [in] the fence to enable signaling
*
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index c3386a6..f8b3c6b 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -321,13 +321,6 @@ int sync_fence_wait(struct sync_fence *sync_fence, long timeout)
}
EXPORT_SYMBOL(sync_fence_wait);
-static const char *sync_fence_get_timeline_name(struct fence *fence)
-{
- struct fence_timeline *parent = fence_parent(fence);
-
- return parent->name;
-}
-
static bool sync_fence_signaled(struct fence *fence)
{
struct fence_timeline *parent = fence_parent(fence);
@@ -377,7 +370,7 @@ static void sync_fence_timeline_value_str(struct fence *fence,
static const struct fence_ops sync_fence_ops = {
.get_driver_name = fence_default_get_driver_name,
- .get_timeline_name = sync_fence_get_timeline_name,
+ .get_timeline_name = fence_default_get_timeline_name,
.enable_signaling = fence_default_enable_signaling,
.signaled = sync_fence_signaled,
.wait = fence_default_wait,
diff --git a/include/linux/fence.h b/include/linux/fence.h
index f355c28a..e8f9f12 100644
--- a/include/linux/fence.h
+++ b/include/linux/fence.h
@@ -295,6 +295,7 @@ static inline void fence_put(struct fence *fence)
int fence_signal(struct fence *fence);
int fence_signal_locked(struct fence *fence);
const char *fence_default_get_driver_name(struct fence *fence);
+const char *fence_default_get_timeline_name(struct fence *fence);
bool fence_default_enable_signaling(struct fence *fence);
signed long fence_default_wait(struct fence *fence, bool intr, signed long timeout);
void fence_default_release(struct fence *fence);
--
2.5.0