public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] asm-generic: fix local_add_unless macro
@ 2009-01-22 14:07 Roel Kluin
  2009-01-22 18:05 ` Mathieu Desnoyers
  2009-01-23 15:45 ` Mathieu Desnoyers
  0 siblings, 2 replies; 5+ messages in thread
From: Roel Kluin @ 2009-01-22 14:07 UTC (permalink / raw)
  To: Mathieu Desnoyers, lkml

When this macro isn't called with 'a' this will 
result in a build failure.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
index dbd6150..fc21844 100644
--- a/include/asm-generic/local.h
+++ b/include/asm-generic/local.h
@@ -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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] asm-generic: fix local_add_unless macro
  2009-01-22 14:07 [PATCH] asm-generic: fix local_add_unless macro Roel Kluin
@ 2009-01-22 18:05 ` Mathieu Desnoyers
  2009-01-23 15:45 ` Mathieu Desnoyers
  1 sibling, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2009-01-22 18:05 UTC (permalink / raw)
  To: Roel Kluin; +Cc: lkml

* Roel Kluin (roel.kluin@gmail.com) 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


> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
> index dbd6150..fc21844 100644
> --- a/include/asm-generic/local.h
> +++ b/include/asm-generic/local.h
> @@ -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

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] asm-generic: fix local_add_unless macro
  2009-01-22 14:07 [PATCH] asm-generic: fix local_add_unless macro Roel Kluin
  2009-01-22 18:05 ` Mathieu Desnoyers
@ 2009-01-23 15:45 ` Mathieu Desnoyers
  2009-05-12 21:31   ` Roel Kluin
  1 sibling, 1 reply; 5+ messages in thread
From: Mathieu Desnoyers @ 2009-01-23 15:45 UTC (permalink / raw)
  To: Roel Kluin; +Cc: lkml

* Roel Kluin (roel.kluin@gmail.com) 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,

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>

> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
> index dbd6150..fc21844 100644
> --- a/include/asm-generic/local.h
> +++ b/include/asm-generic/local.h
> @@ -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

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] asm-generic: fix local_add_unless macro
  2009-01-23 15:45 ` Mathieu Desnoyers
@ 2009-05-12 21:31   ` Roel Kluin
  2009-05-12 21:47     ` Mathieu Desnoyers
  0 siblings, 1 reply; 5+ messages in thread
From: Roel Kluin @ 2009-05-12 21:31 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lkml, Andrew Morton

------------------------------>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 <roel.kluin@gmail.com>
---
Was this patch lost? it's still not in current git.

diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
index dbd6150..fc21844 100644
--- a/include/asm-generic/local.h
+++ b/include/asm-generic/local.h
@@ -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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] asm-generic: fix local_add_unless macro
  2009-05-12 21:31   ` Roel Kluin
@ 2009-05-12 21:47     ` Mathieu Desnoyers
  0 siblings, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2009-05-12 21:47 UTC (permalink / raw)
  To: Roel Kluin; +Cc: lkml, Andrew Morton

* Roel Kluin (roel.kluin@gmail.com) 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 <roel.kluin@gmail.com>

It looks good to me.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>

> ---
> Was this patch lost? it's still not in current git.
> 
> diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
> index dbd6150..fc21844 100644
> --- a/include/asm-generic/local.h
> +++ b/include/asm-generic/local.h
> @@ -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

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-05-12 21:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-22 14:07 [PATCH] asm-generic: fix local_add_unless macro Roel Kluin
2009-01-22 18:05 ` Mathieu Desnoyers
2009-01-23 15:45 ` Mathieu Desnoyers
2009-05-12 21:31   ` Roel Kluin
2009-05-12 21:47     ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox