Skip to content

Commit

Permalink
Rename an argument from "exp" to "expect" since the former makes Flex…
Browse files Browse the repository at this point in the history
…eLint

uneasy, in case anybody think it might be exp(3) in libm.

This also makes it consistent with other archs.
  • Loading branch information
bsdphk committed May 20, 2010
1 parent 3c3fa2f commit 3cad03a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions sys/amd64/include/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \
void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)

int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src);
int atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src);
int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src);
int atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src);
u_int atomic_fetchadd_int(volatile u_int *p, u_int v);
u_long atomic_fetchadd_long(volatile u_long *p, u_long v);

Expand Down Expand Up @@ -124,13 +124,13 @@ struct __hack
/*
* Atomic compare and set, used by the mutex functions
*
* if (*dst == exp) *dst = src (all 32 bit words)
* if (*dst == expect) *dst = src (all 32 bit words)
*
* Returns 0 on failure, non-zero on success
*/

static __inline int
atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src)
{
u_char res;

Expand All @@ -143,15 +143,15 @@ atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
: "=a" (res), /* 0 */
"=m" (*dst) /* 1 */
: "r" (src), /* 2 */
"a" (exp), /* 3 */
"a" (expect), /* 3 */
"m" (*dst) /* 4 */
: "memory");

return (res);
}

static __inline int
atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src)
atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src)
{
u_char res;

Expand All @@ -164,7 +164,7 @@ atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src)
: "=a" (res), /* 0 */
"=m" (*dst) /* 1 */
: "r" (src), /* 2 */
"a" (exp), /* 3 */
"a" (expect), /* 3 */
"m" (*dst) /* 4 */
: "memory");

Expand Down
16 changes: 8 additions & 8 deletions sys/i386/include/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v); \
void atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)

int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src);
int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src);
u_int atomic_fetchadd_int(volatile u_int *p, u_int v);

#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \
Expand Down Expand Up @@ -122,15 +122,15 @@ struct __hack
/*
* Atomic compare and set, used by the mutex functions
*
* if (*dst == exp) *dst = src (all 32 bit words)
* if (*dst == expect) *dst = src (all 32 bit words)
*
* Returns 0 on failure, non-zero on success
*/

#ifdef CPU_DISABLE_CMPXCHG

static __inline int
atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src)
{
u_char res;

Expand All @@ -147,7 +147,7 @@ atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
: "=q" (res), /* 0 */
"=m" (*dst) /* 1 */
: "r" (src), /* 2 */
"r" (exp), /* 3 */
"r" (expect), /* 3 */
"m" (*dst) /* 4 */
: "memory");

Expand All @@ -157,7 +157,7 @@ atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
#else /* !CPU_DISABLE_CMPXCHG */

static __inline int
atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src)
{
u_char res;

Expand All @@ -170,7 +170,7 @@ atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
: "=a" (res), /* 0 */
"=m" (*dst) /* 1 */
: "r" (src), /* 2 */
"a" (exp), /* 3 */
"a" (expect), /* 3 */
"m" (*dst) /* 4 */
: "memory");

Expand Down Expand Up @@ -292,10 +292,10 @@ ATOMIC_STORE_LOAD(long, "cmpxchgl %0,%1", "xchgl %1,%0");
#ifndef WANT_FUNCTIONS

static __inline int
atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src)
atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src)
{

return (atomic_cmpset_int((volatile u_int *)dst, (u_int)exp,
return (atomic_cmpset_int((volatile u_int *)dst, (u_int)expect,
(u_int)src));
}

Expand Down

0 comments on commit 3cad03a

Please sign in to comment.