summaryrefslogtreecommitdiffstats
path: root/drivers/dma-buf
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-05-13 08:47:47 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-05-13 13:38:59 +0100
commit1c530d431c698f156538b8954b07df95337beb34 (patch)
tree06a1acc1f0cd38f59b2b4b6adc653d7a0a461daa /drivers/dma-buf
parent761e9f4f80a21a4b845097027030bef863001636 (diff)
downloadlinux-stable-1c530d431c698f156538b8954b07df95337beb34.tar.gz
linux-stable-1c530d431c698f156538b8954b07df95337beb34.tar.bz2
linux-stable-1c530d431c698f156538b8954b07df95337beb34.zip
dma-buf: Use atomic_fetch_add() for the context id
Now that atomic64_fetch_add() exists we can use it to return the base context id, rather than the atomic64_add_return(N) - N concoction. Suggested-by: Mika Kuoppala <mika.kuoppala@linux.intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com> Reviewed-by: Maciej Patelczyk <maciej.patelczyk@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200513074809.18194-2-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/dma-buf')
-rw-r--r--drivers/dma-buf/dma-fence.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 052a41e2451c..90edf2b281b0 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(dma_fence_get_stub);
u64 dma_fence_context_alloc(unsigned num)
{
WARN_ON(!num);
- return atomic64_add_return(num, &dma_fence_context_counter) - num;
+ return atomic64_fetch_add(num, &dma_fence_context_counter);
}
EXPORT_SYMBOL(dma_fence_context_alloc);