public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] asm-generic: move cmpxchg*_local defs to cmpxchg.h
@ 2013-02-28  5:54 Jonas Bonn
  2013-03-12 12:35 ` Jonas Bonn
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Bonn @ 2013-02-28  5:54 UTC (permalink / raw)
  To: arnd; +Cc: linux-arch, linux-kernel, Jonas Bonn, David Howells

asm/cmpxchg.h can be included on its own and needs to be self-consistent.
The definitions for the cmpxchg*_local macros, as such, need to be part
of this file.

This fixes a build issue on OpenRISC since the system.h smashing patch
96f951edb1f1bdbbc99b0cd458f9808bb83d58ae that introdued the direct inclusion
asm/cmpxchg.h into linux/llist.h.

CC: David Howells <dhowells@redhat.com>
Signed-off-by: Jonas Bonn <jonas@southpole.se>
---
 include/asm-generic/atomic.h  |    6 ------
 include/asm-generic/cmpxchg.h |   10 ++++++++++
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 1ced641..33bd2de 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -136,12 +136,6 @@ static inline void atomic_dec(atomic_t *v)
 #define atomic_xchg(ptr, v)		(xchg(&(ptr)->counter, (v)))
 #define atomic_cmpxchg(v, old, new)	(cmpxchg(&((v)->counter), (old), (new)))
 
-#define cmpxchg_local(ptr, o, n)				  	       \
-	((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
-			(unsigned long)(n), sizeof(*(ptr))))
-
-#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
-
 static inline int __atomic_add_unless(atomic_t *v, int a, int u)
 {
   int c, old;
diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h
index 1488302..811fb1e 100644
--- a/include/asm-generic/cmpxchg.h
+++ b/include/asm-generic/cmpxchg.h
@@ -92,6 +92,16 @@ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
  */
 #include <asm-generic/cmpxchg-local.h>
 
+#ifndef cmpxchg_local
+#define cmpxchg_local(ptr, o, n)				  	       \
+	((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
+			(unsigned long)(n), sizeof(*(ptr))))
+#endif
+
+#ifndef cmpxchg64_local
+#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
+#endif
+
 #define cmpxchg(ptr, o, n)	cmpxchg_local((ptr), (o), (n))
 #define cmpxchg64(ptr, o, n)	cmpxchg64_local((ptr), (o), (n))
 
-- 
1.7.10.4

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

* Re: [PATCH 1/1] asm-generic: move cmpxchg*_local defs to cmpxchg.h
  2013-02-28  5:54 [PATCH 1/1] asm-generic: move cmpxchg*_local defs to cmpxchg.h Jonas Bonn
@ 2013-03-12 12:35 ` Jonas Bonn
  2013-03-12 13:05   ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Bonn @ 2013-03-12 12:35 UTC (permalink / raw)
  To: arnd; +Cc: Jonas Bonn, linux-arch, linux-kernel, David Howells

Hi Arnd,

Can you comment on this patch?  This is needed so that the generic 
asm/cmpxchg.h can be used standalone (i.e. without pulling in atomic.h). 
  OpenRISC uses the generic asm/cmpxchg.h and things currently don't 
build without this since linux/llist.h now includes asm/cmpxchg.h 
standalone.

Thanks,
Jonas

On 02/28/2013 06:54 AM, Jonas Bonn wrote:
> asm/cmpxchg.h can be included on its own and needs to be self-consistent.
> The definitions for the cmpxchg*_local macros, as such, need to be part
> of this file.
>
> This fixes a build issue on OpenRISC since the system.h smashing patch
> 96f951edb1f1bdbbc99b0cd458f9808bb83d58ae that introdued the direct inclusion
> asm/cmpxchg.h into linux/llist.h.
>
> CC: David Howells <dhowells@redhat.com>
> Signed-off-by: Jonas Bonn <jonas@southpole.se>
> ---
>   include/asm-generic/atomic.h  |    6 ------
>   include/asm-generic/cmpxchg.h |   10 ++++++++++
>   2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
> index 1ced641..33bd2de 100644
> --- a/include/asm-generic/atomic.h
> +++ b/include/asm-generic/atomic.h
> @@ -136,12 +136,6 @@ static inline void atomic_dec(atomic_t *v)
>   #define atomic_xchg(ptr, v)		(xchg(&(ptr)->counter, (v)))
>   #define atomic_cmpxchg(v, old, new)	(cmpxchg(&((v)->counter), (old), (new)))
>
> -#define cmpxchg_local(ptr, o, n)				  	       \
> -	((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
> -			(unsigned long)(n), sizeof(*(ptr))))
> -
> -#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
> -
>   static inline int __atomic_add_unless(atomic_t *v, int a, int u)
>   {
>     int c, old;
> diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h
> index 1488302..811fb1e 100644
> --- a/include/asm-generic/cmpxchg.h
> +++ b/include/asm-generic/cmpxchg.h
> @@ -92,6 +92,16 @@ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
>    */
>   #include <asm-generic/cmpxchg-local.h>
>
> +#ifndef cmpxchg_local
> +#define cmpxchg_local(ptr, o, n)				  	       \
> +	((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
> +			(unsigned long)(n), sizeof(*(ptr))))
> +#endif
> +
> +#ifndef cmpxchg64_local
> +#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
> +#endif
> +
>   #define cmpxchg(ptr, o, n)	cmpxchg_local((ptr), (o), (n))
>   #define cmpxchg64(ptr, o, n)	cmpxchg64_local((ptr), (o), (n))
>
>

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

* Re: [PATCH 1/1] asm-generic: move cmpxchg*_local defs to cmpxchg.h
  2013-03-12 12:35 ` Jonas Bonn
@ 2013-03-12 13:05   ` Arnd Bergmann
  2013-03-12 13:05     ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2013-03-12 13:05 UTC (permalink / raw)
  To: Jonas Bonn; +Cc: linux-arch, linux-kernel, David Howells

On Tuesday 12 March 2013, Jonas Bonn wrote:
> Can you comment on this patch?  This is needed so that the generic 
> asm/cmpxchg.h can be used standalone (i.e. without pulling in atomic.h). 
>   OpenRISC uses the generic asm/cmpxchg.h and things currently don't 
> build without this since linux/llist.h now includes asm/cmpxchg.h 
> standalone.

Looks fine to me, I thought I had replied to this earlier, but I don't
see it in my 'sent-mail' folder now, so I assume I did not.

Please send this as a bug fix through your own tree.

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH 1/1] asm-generic: move cmpxchg*_local defs to cmpxchg.h
  2013-03-12 13:05   ` Arnd Bergmann
@ 2013-03-12 13:05     ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2013-03-12 13:05 UTC (permalink / raw)
  To: Jonas Bonn; +Cc: linux-arch, linux-kernel, David Howells

On Tuesday 12 March 2013, Jonas Bonn wrote:
> Can you comment on this patch?  This is needed so that the generic 
> asm/cmpxchg.h can be used standalone (i.e. without pulling in atomic.h). 
>   OpenRISC uses the generic asm/cmpxchg.h and things currently don't 
> build without this since linux/llist.h now includes asm/cmpxchg.h 
> standalone.

Looks fine to me, I thought I had replied to this earlier, but I don't
see it in my 'sent-mail' folder now, so I assume I did not.

Please send this as a bug fix through your own tree.

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

end of thread, other threads:[~2013-03-12 13:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-28  5:54 [PATCH 1/1] asm-generic: move cmpxchg*_local defs to cmpxchg.h Jonas Bonn
2013-03-12 12:35 ` Jonas Bonn
2013-03-12 13:05   ` Arnd Bergmann
2013-03-12 13:05     ` Arnd Bergmann

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