]>
Commit | Line | Data |
---|---|---|
722dfc38 GKH |
1 | From 8111477663813caa1a4469cfe6afaae36cd04513 Mon Sep 17 00:00:00 2001 |
2 | From: Chris Wilson <chris@chris-wilson.co.uk> | |
3 | Date: Thu, 29 Jun 2017 13:59:24 +0100 | |
4 | Subject: dma-buf/dma-fence: Extract __dma_fence_is_later() | |
5 | ||
6 | From: Chris Wilson <chris@chris-wilson.co.uk> | |
7 | ||
8 | commit 8111477663813caa1a4469cfe6afaae36cd04513 upstream. | |
9 | ||
10 | Often we have the task of comparing two seqno known to be on the same | |
11 | context, so provide a common __dma_fence_is_later(). | |
12 | ||
13 | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> | |
14 | Cc: Sumit Semwal <sumit.semwal@linaro.org> | |
15 | Cc: Sean Paul <seanpaul@chromium.org> | |
16 | Cc: Gustavo Padovan <gustavo@padovan.org> | |
17 | Reviewed-by: Sean Paul <seanpaul@chromium.org> | |
18 | Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com> | |
19 | Link: http://patchwork.freedesktop.org/patch/msgid/20170629125930.821-1-chris@chris-wilson.co.uk | |
20 | [renamed to __fence_is_later() - gregkh] | |
21 | Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com> | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
23 | ||
24 | --- | |
25 | include/linux/fence.h | 15 ++++++++++++++- | |
26 | 1 file changed, 14 insertions(+), 1 deletion(-) | |
27 | ||
28 | --- a/include/linux/fence.h | |
29 | +++ b/include/linux/fence.h | |
30 | @@ -281,6 +281,19 @@ fence_is_signaled(struct fence *fence) | |
31 | } | |
32 | ||
33 | /** | |
34 | + * __fence_is_later - return if f1 is chronologically later than f2 | |
35 | + * @f1: [in] the first fence's seqno | |
36 | + * @f2: [in] the second fence's seqno from the same context | |
37 | + * | |
38 | + * Returns true if f1 is chronologically later than f2. Both fences must be | |
39 | + * from the same context, since a seqno is not common across contexts. | |
40 | + */ | |
41 | +static inline bool __fence_is_later(u32 f1, u32 f2) | |
42 | +{ | |
43 | + return (int)(f1 - f2) > 0; | |
44 | +} | |
45 | + | |
46 | +/** | |
47 | * fence_is_later - return if f1 is chronologically later than f2 | |
48 | * @f1: [in] the first fence from the same context | |
49 | * @f2: [in] the second fence from the same context | |
50 | @@ -293,7 +306,7 @@ static inline bool fence_is_later(struct | |
51 | if (WARN_ON(f1->context != f2->context)) | |
52 | return false; | |
53 | ||
54 | - return (int)(f1->seqno - f2->seqno) > 0; | |
55 | + return __fence_is_later(f1->seqno, f2->seqno); | |
56 | } | |
57 | ||
58 | /** |