asm-generic: fix local_add_unless macro
PATCH 1/1 asm-generic: fix local_add_unless macro
When this macro isn't called with 'a' this will
result in a build failure.
---
include/asm-generic/local.h +1 -1
@@ -42,7 +42,7 @@ typedef struct#define local_cmpxchg (l, o, n) atomic_long_cmpxchg((&(l)->a), (o), (n))#define local_xchg (l, n) atomic_long_xchg((&(l)->a), (n)) -#define local_add_unless (l, a, u) atomic_long_add_unless((&(l)->a), (a), (u)) +#define local_add_unless (l, _a, u) atomic_long_add_unless((&(l)->a), (_a), (u))#define local_inc_not_zero (l) atomic_long_inc_not_zero(&(l)->a)/* Non-atomic variants, ie. preemption disabled and won't be touched
Quoted 3 lines · * Roel Kluin ([email protected]) wrote:
When this macro isn't called with 'a' this will
result in a build failure.
Can I have a look at the offending calling code and the build failure output ? We might consider changing these for static inlines instead. And clearly, just changing a single primitive is not going to work. We need to address the other similar in the same file at the very least.
Mathieu
Quoted 15 lines
Signed-off-by Roel Kluin <[email protected]>---
include/asm-generic/local.h +1
-1@@ -42,7 +42,7 @@ typedef struct#define local_cmpxchg (l, o, n) atomic_long_cmpxchg((&(l)->a), (o), (n))#define local_xchg (l, n) atomic_long_xchg((&(l)->a), (n)) -#define local_add_unless (l, a, u) atomic_long_add_unless((&(l)->a), (a), (u)) +#define local_add_unless (l, _a, u) atomic_long_add_unless((&(l)->a), (_a), (u))#define local_inc_not_zero (l) atomic_long_inc_not_zero(&(l)->a)/* Non-atomic variants, ie. preemption disabled and won't be touched
Signature · 2 lines
Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
Quoted 3 lines · * Roel Kluin ([email protected]) wrote:
When this macro isn't called with 'a' this will
result in a build failure.
Maybe we can add to the changelog, for prople like me who fail to see the obvious :
"because local_add_unless(x, y, z) will be expanded to (&(x)->y, (y), (x)), where (x)->y should be (x)->a.
Thanks,
Quoted 15 lines
Signed-off-by Roel Kluin <[email protected]>---
include/asm-generic/local.h +1
-1@@ -42,7 +42,7 @@ typedef struct#define local_cmpxchg (l, o, n) atomic_long_cmpxchg((&(l)->a), (o), (n))#define local_xchg (l, n) atomic_long_xchg((&(l)->a), (n)) -#define local_add_unless (l, a, u) atomic_long_add_unless((&(l)->a), (a), (u)) +#define local_add_unless (l, _a, u) atomic_long_add_unless((&(l)->a), (_a), (u))#define local_inc_not_zero (l) atomic_long_inc_not_zero(&(l)->a)/* Non-atomic variants, ie. preemption disabled and won't be touched
Signature · 2 lines
Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
PATCH 1/1 asm-generic: fix local_add_unless macro
------------------------------>8-------------8<--------------------------------- local_add_unless(x, y, z)' will be expanded to (&(x)->y, (y), (x))', but &(x)->y' should be &(x)->a'
---
Was this patch lost? it's still not in current git.
include/asm-generic/local.h +1 -1
@@ -42,7 +42,7 @@ typedef struct#define local_cmpxchg (l, o, n) atomic_long_cmpxchg((&(l)->a), (o), (n))#define local_xchg (l, n) atomic_long_xchg((&(l)->a), (n)) -#define local_add_unless (l, a, u) atomic_long_add_unless((&(l)->a), (a), (u)) +#define local_add_unless (l, _a, u) atomic_long_add_unless((&(l)->a), (_a), (u))#define local_inc_not_zero (l) atomic_long_inc_not_zero(&(l)->a)/* Non-atomic variants, ie. preemption disabled and won't be touched
Quoted 5 lines · * Roel Kluin ([email protected]) wrote:
------------------------------>8-------------8<---------------------------------
local_add_unless(x, y, z)' will be expanded to(&(x)->y, (y), (x))', but&(x)->y' should be&(x)->a'Signed-off-by Roel Kluin <[email protected]>
It looks good to me.
Quoted 16 lines
---
Was this patch lost? it's still not in current git.include/asm-generic/local.h +1
-1@@ -42,7 +42,7 @@ typedef struct#define local_cmpxchg (l, o, n) atomic_long_cmpxchg((&(l)->a), (o), (n))#define local_xchg (l, n) atomic_long_xchg((&(l)->a), (n)) -#define local_add_unless (l, a, u) atomic_long_add_unless((&(l)->a), (a), (u)) +#define local_add_unless (l, _a, u) atomic_long_add_unless((&(l)->a), (_a), (u))#define local_inc_not_zero (l) atomic_long_inc_not_zero(&(l)->a)/* Non-atomic variants, ie. preemption disabled and won't be touched
Signature · 2 lines
Mathieu Desnoyers OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68