lkml.org 
[lkml]   [2016]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 09/12] drivers/hv: Employ atomic_fetch_inc()
Date
Now that we have fetch_inc() we can stop using inc_return() - 1.

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: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
drivers/hv/channel.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 56dd261f7142..6f2421a62947 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -397,8 +397,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
unsigned long flags;
int ret = 0;

- next_gpadl_handle =
- (atomic_inc_return(&vmbus_connection.next_gpadl_handle) - 1);
+ next_gpadl_handle = atomic_fetch_inc(&vmbus_connection.next_gpadl_handle);

ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
if (ret)
--
2.6.6
\
 
 \ /
  Last update: 2016-06-20 22:41    [W:0.357 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site