Linux: correct use of atomic_add and atomic_sub functions
authorMarc Dionne <marc.c.dionne@gmail.com>
Sun, 3 Oct 2010 01:02:23 +0000 (21:02 -0400)
committerDerrick Brashear <shadow@dementia.org>
Sun, 3 Oct 2010 02:37:30 +0000 (19:37 -0700)
The rx_atomic_add and rx_atomic_sub functions have arguments
reversed compared to the linux atomic_add and atomic_sub.

Adjust the macros to flip the arguments when calling them

Change-Id: I6d58c8f0ac8ccf09e62c9d3921b9f3ae50ca94c9
Reviewed-on: http://gerrit.openafs.org/2889
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/rx/rx_atomic.h

index 805c285..1fdd66d 100644 (file)
@@ -120,9 +120,9 @@ typedef atomic_t rx_atomic_t;
 #define rx_atomic_read(X)        atomic_read(X)
 #define rx_atomic_inc(X)         atomic_inc(X)
 #define rx_atomic_inc_and_read(X) atomic_inc_return(X)
-#define rx_atomic_add(X, V)      atomic_add(X, V)
+#define rx_atomic_add(X, V)      atomic_add(V, X)
 #define rx_atomic_dec(X)         atomic_dec(X)
-#define rx_atomic_sub(X, V)      atomic_sub(X, V)
+#define rx_atomic_sub(X, V)      atomic_sub(V, X)
 
 #elif defined(AFS_SUN58_ENV)
 typedef struct {