Skip to content

Commit

Permalink
dma-buf: Use atomic_fetch_add() for the context id
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Chris Wilson committed May 13, 2020
1 parent 761e9f4 commit 1c530d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/dma-buf/dma-fence.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1c530d4

Please sign in to comment.