1 From 150b6a9d7d6fffb95c0a5349960a10569e8218b5 Mon Sep 17 00:00:00 2001
2 From: Gustavo Padovan <gustavo.padovan@collabora.com>
3 Date: Sat, 29 Jul 2017 12:22:15 -0300
4 Subject: dma-buf/sw_sync: move timeline_fence_ops around
6 From: Gustavo Padovan <gustavo.padovan@collabora.com>
8 commit 150b6a9d7d6fffb95c0a5349960a10569e8218b5 upstream.
10 We are going to use timeline_fence_signaled() in a internal function in
13 Cc: Chris Wilson <chris@chris-wilson.co.uk>
14 Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
15 Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
16 Link: https://patchwork.freedesktop.org/patch/msgid/20170729152217.8362-1-gustavo@padovan.org
17 [s/dma_fence/fence/g - gregkh]
18 Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 drivers/dma-buf/sw_sync.c | 138 +++++++++++++++++++++++-----------------------
23 1 file changed, 69 insertions(+), 69 deletions(-)
25 --- a/drivers/dma-buf/sw_sync.c
26 +++ b/drivers/dma-buf/sw_sync.c
27 @@ -125,6 +125,75 @@ static void sync_timeline_put(struct syn
28 kref_put(&obj->kref, sync_timeline_free);
31 +static const char *timeline_fence_get_driver_name(struct fence *fence)
36 +static const char *timeline_fence_get_timeline_name(struct fence *fence)
38 + struct sync_timeline *parent = fence_parent(fence);
40 + return parent->name;
43 +static void timeline_fence_release(struct fence *fence)
45 + struct sync_pt *pt = fence_to_sync_pt(fence);
46 + struct sync_timeline *parent = fence_parent(fence);
48 + if (!list_empty(&pt->link)) {
49 + unsigned long flags;
51 + spin_lock_irqsave(fence->lock, flags);
52 + if (!list_empty(&pt->link)) {
53 + list_del(&pt->link);
54 + rb_erase(&pt->node, &parent->pt_tree);
56 + spin_unlock_irqrestore(fence->lock, flags);
59 + sync_timeline_put(parent);
63 +static bool timeline_fence_signaled(struct fence *fence)
65 + struct sync_timeline *parent = fence_parent(fence);
67 + return !__fence_is_later(fence->seqno, parent->value);
70 +static bool timeline_fence_enable_signaling(struct fence *fence)
75 +static void timeline_fence_value_str(struct fence *fence,
76 + char *str, int size)
78 + snprintf(str, size, "%d", fence->seqno);
81 +static void timeline_fence_timeline_value_str(struct fence *fence,
82 + char *str, int size)
84 + struct sync_timeline *parent = fence_parent(fence);
86 + snprintf(str, size, "%d", parent->value);
89 +static const struct fence_ops timeline_fence_ops = {
90 + .get_driver_name = timeline_fence_get_driver_name,
91 + .get_timeline_name = timeline_fence_get_timeline_name,
92 + .enable_signaling = timeline_fence_enable_signaling,
93 + .signaled = timeline_fence_signaled,
94 + .wait = fence_default_wait,
95 + .release = timeline_fence_release,
96 + .fence_value_str = timeline_fence_value_str,
97 + .timeline_value_str = timeline_fence_timeline_value_str,
101 * sync_timeline_signal() - signal a status change on a sync_timeline
102 * @obj: sync_timeline to signal
103 @@ -216,75 +285,6 @@ unlock:
107 -static const char *timeline_fence_get_driver_name(struct fence *fence)
112 -static const char *timeline_fence_get_timeline_name(struct fence *fence)
114 - struct sync_timeline *parent = fence_parent(fence);
116 - return parent->name;
119 -static void timeline_fence_release(struct fence *fence)
121 - struct sync_pt *pt = fence_to_sync_pt(fence);
122 - struct sync_timeline *parent = fence_parent(fence);
124 - if (!list_empty(&pt->link)) {
125 - unsigned long flags;
127 - spin_lock_irqsave(fence->lock, flags);
128 - if (!list_empty(&pt->link)) {
129 - list_del(&pt->link);
130 - rb_erase(&pt->node, &parent->pt_tree);
132 - spin_unlock_irqrestore(fence->lock, flags);
135 - sync_timeline_put(parent);
139 -static bool timeline_fence_signaled(struct fence *fence)
141 - struct sync_timeline *parent = fence_parent(fence);
143 - return !__fence_is_later(fence->seqno, parent->value);
146 -static bool timeline_fence_enable_signaling(struct fence *fence)
151 -static void timeline_fence_value_str(struct fence *fence,
152 - char *str, int size)
154 - snprintf(str, size, "%d", fence->seqno);
157 -static void timeline_fence_timeline_value_str(struct fence *fence,
158 - char *str, int size)
160 - struct sync_timeline *parent = fence_parent(fence);
162 - snprintf(str, size, "%d", parent->value);
165 -static const struct fence_ops timeline_fence_ops = {
166 - .get_driver_name = timeline_fence_get_driver_name,
167 - .get_timeline_name = timeline_fence_get_timeline_name,
168 - .enable_signaling = timeline_fence_enable_signaling,
169 - .signaled = timeline_fence_signaled,
170 - .wait = fence_default_wait,
171 - .release = timeline_fence_release,
172 - .fence_value_str = timeline_fence_value_str,
173 - .timeline_value_str = timeline_fence_timeline_value_str,