[PATCH 12/12] dma-buf/fence: Employ atomic_fetch_add
From: Davidlohr Bueso
Date: Mon Jun 20 2016 - 16:09:34 EST
Now that we have fetch_add() we can stop using add_return() - num.
These are very similar to the existing OP-RETURN primitives we already
have, except they return the value of the atomic variable _before_
modification.
Cc: Sumit Semwal <sumit.semwal@xxxxxxxxxx>
Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx>
---
drivers/dma-buf/fence.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c
index 7b05dbe9b296..a58da5da112c 100644
--- a/drivers/dma-buf/fence.c
+++ b/drivers/dma-buf/fence.c
@@ -47,7 +47,7 @@ static atomic_t fence_context_counter = ATOMIC_INIT(0);
unsigned fence_context_alloc(unsigned num)
{
BUG_ON(!num);
- return atomic_add_return(num, &fence_context_counter) - num;
+ return atomic_fetch_add(num, &fence_context_counter);
}
EXPORT_SYMBOL(fence_context_alloc);
--
2.6.6