aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma-buf/dma-fence.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma-buf/dma-fence.c')
-rw-r--r--drivers/dma-buf/dma-fence.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 57da14c15987..56e0a0e1b600 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -75,11 +75,6 @@ int dma_fence_signal_locked(struct dma_fence *fence)
75 if (WARN_ON(!fence)) 75 if (WARN_ON(!fence))
76 return -EINVAL; 76 return -EINVAL;
77 77
78 if (!ktime_to_ns(fence->timestamp)) {
79 fence->timestamp = ktime_get();
80 smp_mb__before_atomic();
81 }
82
83 if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) { 78 if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
84 ret = -EINVAL; 79 ret = -EINVAL;
85 80
@@ -87,8 +82,11 @@ int dma_fence_signal_locked(struct dma_fence *fence)
87 * we might have raced with the unlocked dma_fence_signal, 82 * we might have raced with the unlocked dma_fence_signal,
88 * still run through all callbacks 83 * still run through all callbacks
89 */ 84 */
90 } else 85 } else {
86 fence->timestamp = ktime_get();
87 set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
91 trace_dma_fence_signaled(fence); 88 trace_dma_fence_signaled(fence);
89 }
92 90
93 list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) { 91 list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
94 list_del_init(&cur->node); 92 list_del_init(&cur->node);
@@ -115,14 +113,11 @@ int dma_fence_signal(struct dma_fence *fence)
115 if (!fence) 113 if (!fence)
116 return -EINVAL; 114 return -EINVAL;
117 115
118 if (!ktime_to_ns(fence->timestamp)) {
119 fence->timestamp = ktime_get();
120 smp_mb__before_atomic();
121 }
122
123 if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) 116 if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
124 return -EINVAL; 117 return -EINVAL;
125 118
119 fence->timestamp = ktime_get();
120 set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
126 trace_dma_fence_signaled(fence); 121 trace_dma_fence_signaled(fence);
127 122
128 if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) { 123 if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {