1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#include <linux/slab.h>
21#include <linux/export.h>
22#include <linux/seqno-fence.h>
23
24static const char *seqno_fence_get_driver_name(struct dma_fence *fence)
25{
26 struct seqno_fence *seqno_fence = to_seqno_fence(fence);
27
28 return seqno_fence->ops->get_driver_name(fence);
29}
30
31static const char *seqno_fence_get_timeline_name(struct dma_fence *fence)
32{
33 struct seqno_fence *seqno_fence = to_seqno_fence(fence);
34
35 return seqno_fence->ops->get_timeline_name(fence);
36}
37
38static bool seqno_enable_signaling(struct dma_fence *fence)
39{
40 struct seqno_fence *seqno_fence = to_seqno_fence(fence);
41
42 return seqno_fence->ops->enable_signaling(fence);
43}
44
45static bool seqno_signaled(struct dma_fence *fence)
46{
47 struct seqno_fence *seqno_fence = to_seqno_fence(fence);
48
49 return seqno_fence->ops->signaled && seqno_fence->ops->signaled(fence);
50}
51
52static void seqno_release(struct dma_fence *fence)
53{
54 struct seqno_fence *f = to_seqno_fence(fence);
55
56 dma_buf_put(f->sync_buf);
57 if (f->ops->release)
58 f->ops->release(fence);
59 else
60 dma_fence_free(&f->base);
61}
62
63static signed long seqno_wait(struct dma_fence *fence, bool intr,
64 signed long timeout)
65{
66 struct seqno_fence *f = to_seqno_fence(fence);
67
68 return f->ops->wait(fence, intr, timeout);
69}
70
71const struct dma_fence_ops seqno_fence_ops = {
72 .get_driver_name = seqno_fence_get_driver_name,
73 .get_timeline_name = seqno_fence_get_timeline_name,
74 .enable_signaling = seqno_enable_signaling,
75 .signaled = seqno_signaled,
76 .wait = seqno_wait,
77 .release = seqno_release,
78};
79EXPORT_SYMBOL(seqno_fence_ops);
80