From: Chris Wilson Date: Wed, 13 May 2020 07:47:47 +0000 (+0100) Subject: dma-buf: Use atomic_fetch_add() for the context id X-Git-Tag: baikal/mips/sdk5.9~13559^2~9^2 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=280bf5fe8fe66b4269353925f2f8be8c107cbae7;p=kernel.git 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 Signed-off-by: Chris Wilson Cc: Mika Kuoppala Reviewed-by: Maciej Patelczyk Link: https://patchwork.freedesktop.org/patch/msgid/20200513074809.18194-2-chris@chris-wilson.co.uk --- diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index 052a41e2451c1..90edf2b281b04 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);