Skip to contentSkip to conversation

Separate atomic_t declaration from asm/atomic.h into asm/atomic_def.h

PATCH In review Huang Ying 4 participants 9 messages Oct 8, 2008 – Oct 18, 2008

Subsystems (8)
Arm (32-bit) PowerPC MIPS s390 +4 more subsystems
lore
Share & tools
lore

Huang Ying

author
#0 lore raw

PATCH 1/1 Separate atomic_t declaration from asm/atomic.h into asm/atomic_def.h

From: Huang Ying <[email protected]>

asm/atomic.h contains both declaration and implementation of atomic_t. So there are some implementation related files included in asm/atomic.h. And atomic_t is a typedef. Combination of above makes it impossible to use atomic_t in files included by atomic.h. Such as atomic_t can not be used in linux/kernel.h on i386, because it is included by asm/atomic.h.

It is reasonable to separate declaration from implementation. So a new file atomic_types.h is added for every architecture to accommodate the declaration of atomic_t.

Includes fixes from Andrew Moton.

---

 arch/alpha/include/asm/atomic.h           |   10 +---------
 arch/alpha/include/asm/atomic_types.h     |   13 +++++++++++++
 arch/arm/include/asm/atomic.h             |    3 +--
 arch/arm/include/asm/atomic_types.h       |    6 ++++++
 arch/avr32/include/asm/atomic.h           |    2 +-
 arch/avr32/include/asm/atomic_types.h     |    6 ++++++
 arch/blackfin/include/asm/atomic.h        |    4 +---
 arch/blackfin/include/asm/atomic_types.h  |    8 ++++++++
 arch/h8300/include/asm/atomic.h           |    3 ++-
 arch/h8300/include/asm/atomic_types.h     |    6 ++++++
 arch/ia64/include/asm/atomic.h            |    8 +-------
 arch/ia64/include/asm/atomic_types.h      |   11 +++++++++++
 arch/m68knommu/include/asm/atomic.h       |    2 +-
 arch/m68knommu/include/asm/atomic_types.h |    6 ++++++
 arch/mips/include/asm/atomic.h            |    3 +--
 arch/mips/include/asm/atomic_types.h      |    6 ++++++
 arch/powerpc/include/asm/atomic.h         |    2 +-
 arch/powerpc/include/asm/atomic_types.h   |    6 ++++++
 arch/s390/include/asm/atomic.h            |    4 +---
 arch/s390/include/asm/atomic_types.h      |    8 ++++++++
 arch/sh/include/asm/atomic.h              |    2 +-
 arch/sh/include/asm/atomic_types.h        |    8 ++++++++
 arch/sparc/include/asm/atomic_32.h        |    4 ++--
 arch/sparc/include/asm/atomic_64.h        |    2 +-
 arch/sparc/include/asm/atomic_types.h     |    8 ++++++++
 include/asm-cris/atomic.h                 |    3 +--
 include/asm-cris/atomic_types.h           |    6 ++++++
 include/asm-frv/atomic.h                  |    5 +----
 include/asm-frv/atomic_types.h            |    8 ++++++++
 include/asm-m32r/atomic.h                 |    8 +-------
 include/asm-m32r/atomic_types.h           |   11 +++++++++++
 include/asm-m68k/atomic.h                 |    2 +-
 include/asm-m68k/atomic_types.h           |    6 ++++++
 include/asm-mn10300/atomic.h              |   11 ++---------
 include/asm-mn10300/atomic_types.h        |   13 +++++++++++++
 include/asm-um/atomic_types.h             |    6 ++++++
 include/asm-x86/atomic_32.h               |   10 +---------
 include/asm-x86/atomic_64.h               |   10 +---------
 include/asm-x86/atomic_types.h            |   13 +++++++++++++
 include/asm-xtensa/atomic.h               |    3 +--
 include/asm-xtensa/atomic_types.h         |    6 ++++++
 41 files changed, 185 insertions(+), 77 deletions(-)
arch/alpha/include/asm/atomic.h +1 -9
@@ -3,6 +3,7 @@
 
 #include <asm/barrier.h>
 #include <asm/system.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
@@ -12,15 +13,6 @@
  * than regular operations.
  */
 
-
-/*
- * Counter is volatile to make sure gcc doesn't try to be clever
- * and move things around on us. We need to use _exactly_ the address
- * the user gave us, not some alias that contains the same information.
- */
-typedef struct { volatile int counter; } atomic_t;
-typedef struct { volatile long counter; } atomic64_t;
-
 #define ATOMIC_INIT(i)		( (atomic_t) { (i) } )
 #define ATOMIC64_INIT(i)	( (atomic64_t) { (i) } )
 
arch/arm/include/asm/atomic.h +1 -2
@@ -13,8 +13,7 @@
 
 #include <linux/compiler.h>
 #include <asm/system.h>
-
-typedef struct { volatile int counter; } atomic_t;
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)	{ (i) }
 
arch/avr32/include/asm/atomic.h +1 -1
@@ -15,8 +15,8 @@
 #define __ASM_AVR32_ATOMIC_H
 
 #include <asm/system.h>
+#include <asm/atomic_types.h>
 
-typedef struct { volatile int counter; } atomic_t;
 #define ATOMIC_INIT(i)  { (i) }
 
 #define atomic_read(v)		((v)->counter)
arch/blackfin/include/asm/atomic.h +1 -3
@@ -2,6 +2,7 @@
 #define __ARCH_BLACKFIN_ATOMIC__
 
 #include <asm/system.h>	/* local_irq_XXX() */
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
@@ -13,9 +14,6 @@
  * Tony Kou ([email protected])   Lineo Inc.   2001
  */
 
-typedef struct {
-	int counter;
-} atomic_t;
 #define ATOMIC_INIT(i)	{ (i) }
 
 #define atomic_read(v)		((v)->counter)
arch/h8300/include/asm/atomic.h +2 -1
@@ -1,12 +1,13 @@
 #ifndef __ARCH_H8300_ATOMIC__
 #define __ARCH_H8300_ATOMIC__
 
+#include <asm/atomic_types.h>
+
 /*
  * Atomic operations that C can't guarantee us.  Useful for
  * resource counting etc..
  */
 
-typedef struct { int counter; } atomic_t;
 #define ATOMIC_INIT(i)	{ (i) }
 
 #define atomic_read(v)		((v)->counter)
arch/ia64/include/asm/atomic.h +1 -7
@@ -16,13 +16,7 @@
 
 #include <asm/intrinsics.h>
 #include <asm/system.h>
-
-/*
- * On IA-64, counter must always be volatile to ensure that that the
- * memory accesses are ordered.
- */
-typedef struct { volatile __s32 counter; } atomic_t;
-typedef struct { volatile __s64 counter; } atomic64_t;
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)		((atomic_t) { (i) })
 #define ATOMIC64_INIT(i)	((atomic64_t) { (i) })
arch/m68knommu/include/asm/atomic.h +1 -1
@@ -2,6 +2,7 @@
 #define __ARCH_M68KNOMMU_ATOMIC__
 
 #include <asm/system.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
@@ -12,7 +13,6 @@
  * We do not have SMP m68k systems, so we don't have to deal with that.
  */
 
-typedef struct { int counter; } atomic_t;
 #define ATOMIC_INIT(i)	{ (i) }
 
 #define atomic_read(v)		((v)->counter)
arch/mips/include/asm/atomic.h +1 -2
@@ -19,8 +19,7 @@
 #include <asm/cpu-features.h>
 #include <asm/war.h>
 #include <asm/system.h>
-
-typedef struct { volatile int counter; } atomic_t;
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)    { (i) }
 
arch/powerpc/include/asm/atomic.h +1 -1
@@ -5,7 +5,7 @@
  * PowerPC atomic operations
  */
 
-typedef struct { int counter; } atomic_t;
+#include <asm/atomic_types.h>
 
 #ifdef __KERNEL__
 #include <linux/compiler.h>
arch/s390/include/asm/atomic.h +1 -3
@@ -2,6 +2,7 @@
 #define __ARCH_S390_ATOMIC__
 
 #include <linux/compiler.h>
+#include <asm/atomic_types.h>
 
 /*
  *  include/asm-s390/atomic.h
@@ -23,9 +24,6 @@
  * S390 uses 'Compare And Swap' for atomicity in SMP enviroment
  */
 
-typedef struct {
-	int counter;
-} __attribute__ ((aligned (4))) atomic_t;
 #define ATOMIC_INIT(i)  { (i) }
 
 #ifdef __KERNEL__
arch/alpha/include/asm/atomic_types.h new file +13 -0
@@ -0,0 +1,13 @@
+#ifndef _ALPHA_ATOMIC_TYPES_H
+#define _ALPHA_ATOMIC_TYPES_H
+
+
+/*
+ * Counter is volatile to make sure gcc doesn't try to be clever
+ * and move things around on us. We need to use _exactly_ the address
+ * the user gave us, not some alias that contains the same information.
+ */
+typedef struct { volatile int counter; } atomic_t;
+typedef struct { volatile long counter; } atomic64_t;
+
+#endif
arch/arm/include/asm/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef __ASM_ARM_ATOMIC_TYPES_H
+#define __ASM_ARM_ATOMIC_TYPES_H
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
arch/avr32/include/asm/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef __ASM_AVR32_ATOMIC_TYPES_H
+#define __ASM_AVR32_ATOMIC_TYPES_H
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
arch/blackfin/include/asm/atomic_types.h new file +8 -0
@@ -0,0 +1,8 @@
+#ifndef __ARCH_BLACKFIN_ATOMIC_TYPES__
+#define __ARCH_BLACKFIN_ATOMIC_TYPES__
+
+typedef struct {
+	int counter;
+} atomic_t;
+
+#endif
include/asm-cris/atomic.h +1 -2
@@ -7,14 +7,13 @@
 
 #include <asm/system.h>
 #include <asm/arch/atomic.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
  * resource counting etc..
  */
 
-typedef struct { volatile int counter; } atomic_t;
-
 #define ATOMIC_INIT(i)  { (i) }
 
 #define atomic_read(v) ((v)->counter)
include/asm-cris/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef __ASM_CRIS_ATOMIC_TYPES__
+#define __ASM_CRIS_ATOMIC_TYPES__
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
include/asm-frv/atomic.h +1 -4
@@ -17,6 +17,7 @@
 #include <linux/types.h>
 #include <asm/spr-regs.h>
 #include <asm/system.h>
+#include <asm/atomic_types.h>
 
 #ifdef CONFIG_SMP
 #error not SMP safe
@@ -35,10 +36,6 @@
 #define smp_mb__before_atomic_inc()	barrier()
 #define smp_mb__after_atomic_inc()	barrier()
 
-typedef struct {
-	int counter;
-} atomic_t;
-
 #define ATOMIC_INIT(i)		{ (i) }
 #define atomic_read(v)		((v)->counter)
 #define atomic_set(v, i)	(((v)->counter) = (i))
include/asm-frv/atomic_types.h new file +8 -0
@@ -0,0 +1,8 @@
+#ifndef _ASM_ATOMIC_TYPES_H
+#define _ASM_ATOMIC_TYPES_H
+
+typedef struct {
+	int counter;
+} atomic_t;
+
+#endif
arch/h8300/include/asm/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef __ARCH_H8300_ATOMIC_TYPES__
+#define __ARCH_H8300_ATOMIC_TYPES__
+
+typedef struct { int counter; } atomic_t;
+
+#endif
arch/ia64/include/asm/atomic_types.h new file +11 -0
@@ -0,0 +1,11 @@
+#ifndef _ASM_IA64_ATOMIC_TYPES_H
+#define _ASM_IA64_ATOMIC_TYPES_H
+
+/*
+ * On IA-64, counter must always be volatile to ensure that that the
+ * memory accesses are ordered.
+ */
+typedef struct { volatile __s32 counter; } atomic_t;
+typedef struct { volatile __s64 counter; } atomic64_t;
+
+#endif
include/asm-m32r/atomic.h +1 -7
@@ -11,19 +11,13 @@
 
 #include <asm/assembler.h>
 #include <asm/system.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
  * resource counting etc..
  */
 
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct { volatile int counter; } atomic_t;
-
 #define ATOMIC_INIT(i)	{ (i) }
 
 /**
include/asm-m32r/atomic_types.h new file +11 -0
@@ -0,0 +1,11 @@
+#ifndef _ASM_M32R_ATOMIC_TYPES_H
+#define _ASM_M32R_ATOMIC_TYPES_H
+
+/*
+ * Make sure gcc doesn't try to be clever and move things around
+ * on us. We need to use _exactly_ the address the user gave us,
+ * not some alias that contains the same information.
+ */
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
include/asm-m68k/atomic.h +1 -1
@@ -3,6 +3,7 @@
 
 
 #include <asm/system.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
@@ -13,7 +14,6 @@
  * We do not have SMP m68k systems, so we don't have to deal with that.
  */
 
-typedef struct { int counter; } atomic_t;
 #define ATOMIC_INIT(i)	{ (i) }
 
 #define atomic_read(v)		((v)->counter)
include/asm-m68k/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef __ARCH_M68K_ATOMIC_TYPES__
+#define __ARCH_M68K_ATOMIC_TYPES__
+
+typedef struct { int counter; } atomic_t;
+
+#endif
arch/m68knommu/include/asm/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef __ARCH_M68KNOMMU_ATOMIC_TYPES__
+#define __ARCH_M68KNOMMU_ATOMIC_TYPES__
+
+typedef struct { int counter; } atomic_t;
+
+#endif
arch/mips/include/asm/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef _ASM_ATOMIC_TYPES_H
+#define _ASM_ATOMIC_TYPES_H
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
include/asm-mn10300/atomic.h +2 -9
@@ -11,6 +11,8 @@
 #ifndef _ASM_ATOMIC_H
 #define _ASM_ATOMIC_H
 
+#include <asm/atomic_types.h>
+
 #ifdef CONFIG_SMP
 #error not SMP safe
 #endif
@@ -20,15 +22,6 @@
  * resource counting etc..
  */
 
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct {
-	int	counter;
-} atomic_t;
-
 #define ATOMIC_INIT(i)	{ (i) }
 
 #ifdef __KERNEL__
include/asm-mn10300/atomic_types.h new file +13 -0
@@ -0,0 +1,13 @@
+#ifndef _ASM_ATOMIC_TYPES_H
+#define _ASM_ATOMIC_TYPES_H
+
+/*
+ * Make sure gcc doesn't try to be clever and move things around
+ * on us. We need to use _exactly_ the address the user gave us,
+ * not some alias that contains the same information.
+ */
+typedef struct {
+	int	counter;
+} atomic_t;
+
+#endif
arch/powerpc/include/asm/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef _ASM_POWERPC_ATOMIC_TYPES_H_
+#define _ASM_POWERPC_ATOMIC_TYPES_H_
+
+typedef struct { int counter; } atomic_t;
+
+#endif
arch/s390/include/asm/atomic_types.h new file +8 -0
@@ -0,0 +1,8 @@
+#ifndef __ARCH_S390_ATOMIC_TYPES__
+#define __ARCH_S390_ATOMIC_TYPES__
+
+typedef struct {
+	int counter;
+} __attribute__ ((aligned (4))) atomic_t;
+
+#endif
include/asm-um/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef __UM_ATOMIC_TYPES_H
+#define __UM_ATOMIC_TYPES_H
+
+#include "asm/arch/atomic_types.h"
+
+#endif
include/asm-x86/atomic_32.h +1 -9
@@ -4,21 +4,13 @@
 #include <linux/compiler.h>
 #include <asm/processor.h>
 #include <asm/cmpxchg.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
  * resource counting etc..
  */
 
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct {
-	int counter;
-} atomic_t;
-
 #define ATOMIC_INIT(i)	{ (i) }
 
 /**
include/asm-x86/atomic_64.h +1 -9
@@ -3,6 +3,7 @@
 
 #include <asm/alternative.h>
 #include <asm/cmpxchg.h>
+#include <asm/atomic_types.h>
 
 /* atomic_t should be 32 bit signed type */
 
@@ -11,15 +12,6 @@
  * resource counting etc..
  */
 
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct {
-	int counter;
-} atomic_t;
-
 #define ATOMIC_INIT(i)	{ (i) }
 
 /**
include/asm-x86/atomic_types.h new file +13 -0
@@ -0,0 +1,13 @@
+#ifndef __ARCH_X86_ATOMIC_TYPES__
+#define __ARCH_X86_ATOMIC_TYPES__
+
+/*
+ * Make sure gcc doesn't try to be clever and move things around
+ * on us. We need to use _exactly_ the address the user gave us,
+ * not some alias that contains the same information.
+ */
+typedef struct {
+	int counter;
+} atomic_t;
+
+#endif
include/asm-xtensa/atomic.h +1 -2
@@ -14,8 +14,7 @@
 #define _XTENSA_ATOMIC_H
 
 #include <linux/stringify.h>
-
-typedef struct { volatile int counter; } atomic_t;
+#include <asm/atomic_types.h>
 
 #ifdef __KERNEL__
 #include <asm/processor.h>
include/asm-xtensa/atomic_types.h new file +6 -0
@@ -0,0 +1,6 @@
+#ifndef _XTENSA_ATOMIC_TYPES_H
+#define _XTENSA_ATOMIC_TYPES_H
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
arch/sparc/include/asm/atomic_32.h +2 -2
@@ -13,10 +13,10 @@
 
 #include <linux/types.h>
 
-typedef struct { volatile int counter; } atomic_t;
-
 #ifdef __KERNEL__
 
+#include <asm/atomic_types.h>
+
 #define ATOMIC_INIT(i)  { (i) }
 
 extern int __atomic_add_return(int, atomic_t *);
arch/sparc/include/asm/atomic_64.h +1 -1
@@ -9,8 +9,8 @@
 
 #include <linux/types.h>
 #include <asm/system.h>
+#include <asm/atomic_types.h>
 
-typedef struct { volatile int counter; } atomic_t;
 typedef struct { volatile __s64 counter; } atomic64_t;
 
 #define ATOMIC_INIT(i)		{ (i) }
arch/sparc/include/asm/atomic_types.h new file +8 -0
@@ -0,0 +1,8 @@
+#ifndef _ATOMIC_TYPES_H
+#define _ATOMIC_TYPES_H
+
+typedef struct {
+	volatile int counter;
+} atomic_t;
+
+#endif
arch/sh/include/asm/atomic.h +1 -1
@@ -7,7 +7,7 @@
  *
  */
 
-typedef struct { volatile int counter; } atomic_t;
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)	( (atomic_t) { (i) } )
 
arch/sh/include/asm/atomic_types.h new file +8 -0
@@ -0,0 +1,8 @@
+#ifndef _ASM_IA64_ATOMIC_TYPES_H
+#define _ASM_IA64_ATOMIC_TYPES_H
+
+typedef struct {
+	volatile int counter;
+} atomic_t;
+
+#endif
#1 lore raw
Quoted 8 lines · On Wed, 08 Oct 2008 17:44:30 +0800 Huang Ying <[email protected]> wrote:

From: Huang Ying <[email protected]>

asm/atomic.h contains both declaration and implementation of atomic_t. So there are some implementation related files included in asm/atomic.h. And atomic_t is a typedef. Combination of above makes it impossible to use atomic_t in files included by atomic.h. Such as atomic_t can not be used in linux/kernel.h on i386, because it is included by asm/atomic.h.

Quoted 8 lines

It is reasonable to separate declaration from implementation. So a new file atomic_types.h is added for every architecture to accommodate the declaration of atomic_t.

Includes fixes from Andrew Moton.

The difference between what-i-currently-have and what-you-just-sent is below. It's quite large.

Can you explain this update please?

 arch/alpha/include/asm/atomic.h           |    2 +-
 arch/alpha/include/asm/atomic_types.h     |   13 +++++++++++++
 arch/arm/include/asm/atomic.h             |    2 +-
 arch/arm/include/asm/atomic_types.h       |    6 ++++++
 arch/avr32/include/asm/atomic.h           |    2 +-
 arch/avr32/include/asm/atomic_types.h     |    6 ++++++
 arch/blackfin/include/asm/atomic.h        |    2 +-
 arch/blackfin/include/asm/atomic_types.h  |    8 ++++++++
 arch/h8300/include/asm/atomic.h           |    2 +-
 arch/h8300/include/asm/atomic_types.h     |    6 ++++++
 arch/ia64/include/asm/atomic.h            |    2 +-
 arch/ia64/include/asm/atomic_types.h      |   11 +++++++++++
 arch/m68knommu/include/asm/atomic.h       |    2 +-
 arch/m68knommu/include/asm/atomic_types.h |    6 ++++++
 arch/mips/include/asm/atomic.h            |    2 +-
 arch/mips/include/asm/atomic_types.h      |    6 ++++++
 arch/powerpc/include/asm/atomic.h         |    2 +-
 arch/powerpc/include/asm/atomic_types.h   |    6 ++++++
 arch/s390/include/asm/atomic.h            |    2 +-
 arch/s390/include/asm/atomic_types.h      |    8 ++++++++
 arch/sh/include/asm/atomic.h              |    2 +-
 arch/sh/include/asm/atomic_def.h          |    8 --------
 arch/sh/include/asm/atomic_types.h        |    8 ++++++++
 arch/sparc/include/asm/atomic_32.h        |    2 +-
 arch/sparc/include/asm/atomic_64.h        |    2 +-
 arch/sparc/include/asm/atomic_def.h       |    8 --------
 arch/sparc/include/asm/atomic_types.h     |    8 ++++++++
 include/asm-alpha/atomic_def.h            |   13 -------------
 include/asm-arm/atomic_def.h              |    6 ------
 include/asm-avr32/atomic_def.h            |    6 ------
 include/asm-blackfin/atomic_def.h         |    8 --------
 include/asm-cris/atomic.h                 |    2 +-
 include/asm-cris/atomic_def.h             |    6 ------
 include/asm-cris/atomic_types.h           |    6 ++++++
 include/asm-frv/atomic.h                  |    2 +-
 include/asm-frv/atomic_def.h              |    8 --------
 include/asm-frv/atomic_types.h            |    8 ++++++++
 include/asm-h8300/atomic_def.h            |    6 ------
 include/asm-ia64/atomic_def.h             |   11 -----------
 include/asm-m32r/atomic.h                 |    2 +-
 include/asm-m32r/atomic_def.h             |   11 -----------
 include/asm-m32r/atomic_types.h           |   11 +++++++++++
 include/asm-m68k/atomic.h                 |    2 +-
 include/asm-m68k/atomic_def.h             |    6 ------
 include/asm-m68k/atomic_types.h           |    6 ++++++
 include/asm-m68knommu/atomic_def.h        |    6 ------
 include/asm-mips/atomic.h                 |    6 ------
 include/asm-mn10300/atomic.h              |    2 +-
 include/asm-mn10300/atomic_def.h          |   13 -------------
 include/asm-mn10300/atomic_types.h        |   13 +++++++++++++
 include/asm-powerpc/atomic_def.h          |    6 ------
 include/asm-s390/atomic_def.h             |    8 --------
 include/asm-um/atomic_def.h               |    6 ------
 include/asm-um/atomic_types.h             |    6 ++++++
 include/asm-x86/atomic_32.h               |    2 +-
 include/asm-x86/atomic_64.h               |    2 +-
 include/asm-x86/atomic_def.h              |   13 -------------
 include/asm-x86/atomic_types.h            |   13 +++++++++++++
 include/asm-xtensa/atomic.h               |    2 +-
 include/asm-xtensa/atomic_def.h           |    6 ------
 include/asm-xtensa/atomic_types.h         |    6 ++++++
 61 files changed, 182 insertions(+), 182 deletions(-)
arch/alpha/include/asm/atomic.h renamed from arch/alpha/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/alpha/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/alpha/include/asm/atomic.h
@@ -3,7 +3,7 @@
 
 #include <asm/barrier.h>
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
arch/alpha/include/asm/atomic_types.h new file +13 -0
diff -puN /dev/null arch/alpha/include/asm/atomic_types.h
@@ -0,0 +1,13 @@
+#ifndef _ALPHA_ATOMIC_TYPES_H
+#define _ALPHA_ATOMIC_TYPES_H
+
+
+/*
+ * Counter is volatile to make sure gcc doesn't try to be clever
+ * and move things around on us. We need to use _exactly_ the address
+ * the user gave us, not some alias that contains the same information.
+ */
+typedef struct { volatile int counter; } atomic_t;
+typedef struct { volatile long counter; } atomic64_t;
+
+#endif
arch/arm/include/asm/atomic.h renamed from arch/arm/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/arm/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/arm/include/asm/atomic.h
@@ -13,7 +13,7 @@
 
 #include <linux/compiler.h>
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)	{ (i) }
 
arch/arm/include/asm/atomic_types.h new file +6 -0
diff -puN /dev/null arch/arm/include/asm/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_ARM_ATOMIC_TYPES_H
+#define __ASM_ARM_ATOMIC_TYPES_H
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
arch/avr32/include/asm/atomic.h renamed from arch/avr32/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/avr32/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/avr32/include/asm/atomic.h
@@ -15,7 +15,7 @@
 #define __ASM_AVR32_ATOMIC_H
 
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)  { (i) }
 
arch/avr32/include/asm/atomic_types.h new file +6 -0
diff -puN /dev/null arch/avr32/include/asm/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_AVR32_ATOMIC_TYPES_H
+#define __ASM_AVR32_ATOMIC_TYPES_H
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
arch/blackfin/include/asm/atomic.h renamed from arch/blackfin/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/blackfin/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/blackfin/include/asm/atomic.h
@@ -2,7 +2,7 @@
 #define __ARCH_BLACKFIN_ATOMIC__
 
 #include <asm/system.h>	/* local_irq_XXX() */
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
arch/blackfin/include/asm/atomic_types.h new file +8 -0
diff -puN /dev/null arch/blackfin/include/asm/atomic_types.h
@@ -0,0 +1,8 @@
+#ifndef __ARCH_BLACKFIN_ATOMIC_TYPES__
+#define __ARCH_BLACKFIN_ATOMIC_TYPES__
+
+typedef struct {
+	int counter;
+} atomic_t;
+
+#endif
arch/h8300/include/asm/atomic.h renamed from arch/h8300/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/h8300/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/h8300/include/asm/atomic.h
@@ -1,7 +1,7 @@
 #ifndef __ARCH_H8300_ATOMIC__
 #define __ARCH_H8300_ATOMIC__
 
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
arch/h8300/include/asm/atomic_types.h new file +6 -0
diff -puN /dev/null arch/h8300/include/asm/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef __ARCH_H8300_ATOMIC_TYPES__
+#define __ARCH_H8300_ATOMIC_TYPES__
+
+typedef struct { int counter; } atomic_t;
+
+#endif
arch/ia64/include/asm/atomic.h renamed from arch/ia64/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/ia64/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/ia64/include/asm/atomic.h
@@ -16,7 +16,7 @@
 
 #include <asm/intrinsics.h>
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)		((atomic_t) { (i) })
 #define ATOMIC64_INIT(i)	((atomic64_t) { (i) })
arch/ia64/include/asm/atomic_types.h new file +11 -0
diff -puN /dev/null arch/ia64/include/asm/atomic_types.h
@@ -0,0 +1,11 @@
+#ifndef _ASM_IA64_ATOMIC_TYPES_H
+#define _ASM_IA64_ATOMIC_TYPES_H
+
+/*
+ * On IA-64, counter must always be volatile to ensure that that the
+ * memory accesses are ordered.
+ */
+typedef struct { volatile __s32 counter; } atomic_t;
+typedef struct { volatile __s64 counter; } atomic64_t;
+
+#endif
arch/m68knommu/include/asm/atomic.h renamed from arch/m68knommu/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/m68knommu/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/m68knommu/include/asm/atomic.h
@@ -2,7 +2,7 @@
 #define __ARCH_M68KNOMMU_ATOMIC__
 
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
arch/m68knommu/include/asm/atomic_types.h new file +6 -0
diff -puN /dev/null arch/m68knommu/include/asm/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef __ARCH_M68KNOMMU_ATOMIC_TYPES__
+#define __ARCH_M68KNOMMU_ATOMIC_TYPES__
+
+typedef struct { int counter; } atomic_t;
+
+#endif
arch/mips/include/asm/atomic.h renamed from arch/mips/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/mips/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/mips/include/asm/atomic.h
@@ -19,7 +19,7 @@
 #include <asm/cpu-features.h>
 #include <asm/war.h>
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)    { (i) }
 
arch/mips/include/asm/atomic_types.h new file +6 -0
diff -puN /dev/null arch/mips/include/asm/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_ATOMIC_TYPES_H
+#define _ASM_ATOMIC_TYPES_H
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
arch/powerpc/include/asm/atomic.h renamed from arch/powerpc/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/powerpc/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/powerpc/include/asm/atomic.h
@@ -5,7 +5,7 @@
  * PowerPC atomic operations
  */
 
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #ifdef __KERNEL__
 #include <linux/compiler.h>
arch/powerpc/include/asm/atomic_types.h new file +6 -0
diff -puN /dev/null arch/powerpc/include/asm/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_POWERPC_ATOMIC_TYPES_H_
+#define _ASM_POWERPC_ATOMIC_TYPES_H_
+
+typedef struct { int counter; } atomic_t;
+
+#endif
arch/s390/include/asm/atomic.h renamed from arch/s390/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/s390/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/s390/include/asm/atomic.h
@@ -2,7 +2,7 @@
 #define __ARCH_S390_ATOMIC__
 
 #include <linux/compiler.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /*
  *  include/asm-s390/atomic.h
arch/s390/include/asm/atomic_types.h new file +8 -0
diff -puN /dev/null arch/s390/include/asm/atomic_types.h
@@ -0,0 +1,8 @@
+#ifndef __ARCH_S390_ATOMIC_TYPES__
+#define __ARCH_S390_ATOMIC_TYPES__
+
+typedef struct {
+	int counter;
+} __attribute__ ((aligned (4))) atomic_t;
+
+#endif
arch/sh/include/asm/atomic.h renamed from arch/sh/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/sh/include/asm/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/sh/include/asm/atomic.h
@@ -7,7 +7,7 @@
  *
  */
 
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)	( (atomic_t) { (i) } )
 
arch/sh/include/asm/atomic_def.h deleted +0 -8
diff -puN arch/sh/include/asm/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,8 +0,0 @@
-#ifndef _ASM_IA64_ATOMIC_DEF_H
-#define _ASM_IA64_ATOMIC_DEF_H
-
-typedef struct {
-	volatile int counter;
-} atomic_t;
-
-#endif
arch/sh/include/asm/atomic_types.h new file +8 -0
diff -puN /dev/null arch/sh/include/asm/atomic_types.h
@@ -0,0 +1,8 @@
+#ifndef _ASM_IA64_ATOMIC_TYPES_H
+#define _ASM_IA64_ATOMIC_TYPES_H
+
+typedef struct {
+	volatile int counter;
+} atomic_t;
+
+#endif
arch/sparc/include/asm/atomic_32.h renamed from arch/sparc/include/asm/atomic_32.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/sparc/include/asm/atomic_32.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/sparc/include/asm/atomic_32.h
@@ -15,7 +15,7 @@
 
 #ifdef __KERNEL__
 
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #define ATOMIC_INIT(i)  { (i) }
 
arch/sparc/include/asm/atomic_64.h renamed from arch/sparc/include/asm/atomic_64.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN arch/sparc/include/asm/atomic_64.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update arch/sparc/include/asm/atomic_64.h
@@ -9,7 +9,7 @@
 
 #include <linux/types.h>
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 typedef struct { volatile __s64 counter; } atomic64_t;
 
arch/sparc/include/asm/atomic_def.h deleted +0 -8
diff -puN arch/sparc/include/asm/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,8 +0,0 @@
-#ifndef _ATOMIC_DEF_H
-#define _ATOMIC_DEF_H
-
-typedef struct {
-	volatile int counter;
-} atomic_t;
-
-#endif
arch/sparc/include/asm/atomic_types.h new file +8 -0
diff -puN /dev/null arch/sparc/include/asm/atomic_types.h
@@ -0,0 +1,8 @@
+#ifndef _ATOMIC_TYPES_H
+#define _ATOMIC_TYPES_H
+
+typedef struct {
+	volatile int counter;
+} atomic_t;
+
+#endif
include/asm-alpha/atomic_def.h deleted +0 -13
diff -puN include/asm-alpha/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,13 +0,0 @@
-#ifndef _ALPHA_ATOMIC_DEF_H
-#define _ALPHA_ATOMIC_DEF_H
-
-
-/*
- * Counter is volatile to make sure gcc doesn't try to be clever
- * and move things around on us. We need to use _exactly_ the address
- * the user gave us, not some alias that contains the same information.
- */
-typedef struct { volatile int counter; } atomic_t;
-typedef struct { volatile long counter; } atomic64_t;
-
-#endif
include/asm-arm/atomic_def.h deleted +0 -6
diff -puN include/asm-arm/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ASM_ARM_ATOMIC_DEF_H
-#define __ASM_ARM_ATOMIC_DEF_H
-
-typedef struct { volatile int counter; } atomic_t;
-
-#endif
include/asm-avr32/atomic_def.h deleted +0 -6
diff -puN include/asm-avr32/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ASM_AVR32_ATOMIC_DEF_H
-#define __ASM_AVR32_ATOMIC_DEF_H
-
-typedef struct { volatile int counter; } atomic_t;
-
-#endif
include/asm-blackfin/atomic_def.h deleted +0 -8
diff -puN include/asm-blackfin/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,8 +0,0 @@
-#ifndef __ARCH_BLACKFIN_ATOMIC_DEF__
-#define __ARCH_BLACKFIN_ATOMIC_DEF__
-
-typedef struct {
-	int counter;
-} atomic_t;
-
-#endif
include/asm-cris/atomic.h renamed from include/asm-cris/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN include/asm-cris/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update include/asm-cris/atomic.h
@@ -7,7 +7,7 @@
 
 #include <asm/system.h>
 #include <asm/arch/atomic.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
include/asm-cris/atomic_def.h deleted +0 -6
diff -puN include/asm-cris/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ASM_CRIS_ATOMIC_DEF__
-#define __ASM_CRIS_ATOMIC_DEF__
-
-typedef struct { volatile int counter; } atomic_t;
-
-#endif
include/asm-cris/atomic_types.h new file +6 -0
diff -puN /dev/null include/asm-cris/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_CRIS_ATOMIC_TYPES__
+#define __ASM_CRIS_ATOMIC_TYPES__
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
include/asm-frv/atomic.h renamed from include/asm-frv/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN include/asm-frv/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update include/asm-frv/atomic.h
@@ -17,7 +17,7 @@
 #include <linux/types.h>
 #include <asm/spr-regs.h>
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #ifdef CONFIG_SMP
 #error not SMP safe
include/asm-frv/atomic_def.h deleted +0 -8
diff -puN include/asm-frv/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,8 +0,0 @@
-#ifndef _ASM_ATOMIC_DEF_H
-#define _ASM_ATOMIC_DEF_H
-
-typedef struct {
-	int counter;
-} atomic_t;
-
-#endif
include/asm-frv/atomic_types.h new file +8 -0
diff -puN /dev/null include/asm-frv/atomic_types.h
@@ -0,0 +1,8 @@
+#ifndef _ASM_ATOMIC_TYPES_H
+#define _ASM_ATOMIC_TYPES_H
+
+typedef struct {
+	int counter;
+} atomic_t;
+
+#endif
include/asm-h8300/atomic_def.h deleted +0 -6
diff -puN include/asm-h8300/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ARCH_H8300_ATOMIC_DEF__
-#define __ARCH_H8300_ATOMIC_DEF__
-
-typedef struct { int counter; } atomic_t;
-
-#endif
include/asm-ia64/atomic_def.h deleted +0 -11
diff -puN include/asm-ia64/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,11 +0,0 @@
-#ifndef _ASM_IA64_ATOMIC_DEF_H
-#define _ASM_IA64_ATOMIC_DEF_H
-
-/*
- * On IA-64, counter must always be volatile to ensure that that the
- * memory accesses are ordered.
- */
-typedef struct { volatile __s32 counter; } atomic_t;
-typedef struct { volatile __s64 counter; } atomic64_t;
-
-#endif
include/asm-m32r/atomic.h renamed from include/asm-m32r/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN include/asm-m32r/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update include/asm-m32r/atomic.h
@@ -11,7 +11,7 @@
 
 #include <asm/assembler.h>
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
include/asm-m32r/atomic_def.h deleted +0 -11
diff -puN include/asm-m32r/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,11 +0,0 @@
-#ifndef _ASM_M32R_ATOMIC_DEF_H
-#define _ASM_M32R_ATOMIC_DEF_H
-
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct { volatile int counter; } atomic_t;
-
-#endif
include/asm-m32r/atomic_types.h new file +11 -0
diff -puN /dev/null include/asm-m32r/atomic_types.h
@@ -0,0 +1,11 @@
+#ifndef _ASM_M32R_ATOMIC_TYPES_H
+#define _ASM_M32R_ATOMIC_TYPES_H
+
+/*
+ * Make sure gcc doesn't try to be clever and move things around
+ * on us. We need to use _exactly_ the address the user gave us,
+ * not some alias that contains the same information.
+ */
+typedef struct { volatile int counter; } atomic_t;
+
+#endif
include/asm-m68k/atomic.h renamed from include/asm-m68k/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN include/asm-m68k/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update include/asm-m68k/atomic.h
@@ -3,7 +3,7 @@
 
 
 #include <asm/system.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
include/asm-m68k/atomic_def.h deleted +0 -6
diff -puN include/asm-m68k/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ARCH_M68K_ATOMIC_DEF__
-#define __ARCH_M68K_ATOMIC_DEF__
-
-typedef struct { int counter; } atomic_t;
-
-#endif
include/asm-m68k/atomic_types.h new file +6 -0
diff -puN /dev/null include/asm-m68k/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef __ARCH_M68K_ATOMIC_TYPES__
+#define __ARCH_M68K_ATOMIC_TYPES__
+
+typedef struct { int counter; } atomic_t;
+
+#endif
include/asm-m68knommu/atomic_def.h deleted +0 -6
diff -puN include/asm-m68knommu/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ARCH_M68KNOMMU_ATOMIC_DEF__
-#define __ARCH_M68KNOMMU_ATOMIC_DEF__
-
-typedef struct { int counter; } atomic_t;
-
-#endif
include/asm-mips/atomic.h deleted +0 -6
diff -puN include/asm-mips/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_ATOMIC_DEF_H
-#define _ASM_ATOMIC_DEF_H
-
-typedef struct { volatile int counter; } atomic_t;
-
-#endif
include/asm-mn10300/atomic.h renamed from include/asm-mn10300/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN include/asm-mn10300/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update include/asm-mn10300/atomic.h
@@ -11,7 +11,7 @@
 #ifndef _ASM_ATOMIC_H
 #define _ASM_ATOMIC_H
 
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #ifdef CONFIG_SMP
 #error not SMP safe
include/asm-mn10300/atomic_def.h deleted +0 -13
diff -puN include/asm-mn10300/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,13 +0,0 @@
-#ifndef _ASM_ATOMIC_DEF_H
-#define _ASM_ATOMIC_DEF_H
-
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct {
-	int	counter;
-} atomic_t;
-
-#endif
include/asm-mn10300/atomic_types.h new file +13 -0
diff -puN /dev/null include/asm-mn10300/atomic_types.h
@@ -0,0 +1,13 @@
+#ifndef _ASM_ATOMIC_TYPES_H
+#define _ASM_ATOMIC_TYPES_H
+
+/*
+ * Make sure gcc doesn't try to be clever and move things around
+ * on us. We need to use _exactly_ the address the user gave us,
+ * not some alias that contains the same information.
+ */
+typedef struct {
+	int	counter;
+} atomic_t;
+
+#endif
include/asm-powerpc/atomic_def.h deleted +0 -6
diff -puN include/asm-powerpc/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_POWERPC_ATOMIC_DEF_H_
-#define _ASM_POWERPC_ATOMIC_DEF_H_
-
-typedef struct { int counter; } atomic_t;
-
-#endif
include/asm-s390/atomic_def.h deleted +0 -8
diff -puN include/asm-s390/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,8 +0,0 @@
-#ifndef __ARCH_S390_ATOMIC_DEF__
-#define __ARCH_S390_ATOMIC_DEF__
-
-typedef struct {
-	int counter;
-} __attribute__ ((aligned (4))) atomic_t;
-
-#endif
include/asm-um/atomic_def.h deleted +0 -6
diff -puN include/asm-um/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef __UM_ATOMIC_DEF_H
-#define __UM_ATOMIC_DEF_H
-
-#include "asm/arch/atomic_def.h"
-
-#endif
include/asm-um/atomic_types.h new file +6 -0
diff -puN /dev/null include/asm-um/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef __UM_ATOMIC_TYPES_H
+#define __UM_ATOMIC_TYPES_H
+
+#include "asm/arch/atomic_types.h"
+
+#endif
include/asm-x86/atomic_32.h renamed from include/asm-x86/atomic_32.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN include/asm-x86/atomic_32.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update include/asm-x86/atomic_32.h
@@ -4,7 +4,7 @@
 #include <linux/compiler.h>
 #include <asm/processor.h>
 #include <asm/cmpxchg.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /*
  * Atomic operations that C can't guarantee us.  Useful for
include/asm-x86/atomic_64.h renamed from include/asm-x86/atomic_64.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN include/asm-x86/atomic_64.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update include/asm-x86/atomic_64.h
@@ -3,7 +3,7 @@
 
 #include <asm/alternative.h>
 #include <asm/cmpxchg.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 /* atomic_t should be 32 bit signed type */
 
include/asm-x86/atomic_def.h deleted +0 -13
diff -puN include/asm-x86/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,13 +0,0 @@
-#ifndef __ARCH_X86_ATOMIC_DEF__
-#define __ARCH_X86_ATOMIC_DEF__
-
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct {
-	int counter;
-} atomic_t;
-
-#endif
include/asm-x86/atomic_types.h new file +13 -0
diff -puN /dev/null include/asm-x86/atomic_types.h
@@ -0,0 +1,13 @@
+#ifndef __ARCH_X86_ATOMIC_TYPES__
+#define __ARCH_X86_ATOMIC_TYPES__
+
+/*
+ * Make sure gcc doesn't try to be clever and move things around
+ * on us. We need to use _exactly_ the address the user gave us,
+ * not some alias that contains the same information.
+ */
+typedef struct {
+	int counter;
+} atomic_t;
+
+#endif
include/asm-xtensa/atomic.h renamed from include/asm-xtensa/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update +1 -1
diff -puN include/asm-xtensa/atomic.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update include/asm-xtensa/atomic.h
@@ -14,7 +14,7 @@
 #define _XTENSA_ATOMIC_H
 
 #include <linux/stringify.h>
-#include <asm/atomic_def.h>
+#include <asm/atomic_types.h>
 
 #ifdef __KERNEL__
 #include <asm/processor.h>
include/asm-xtensa/atomic_def.h deleted +0 -6
diff -puN include/asm-xtensa/atomic_def.h~separate-atomic_t-declaration-from-asm-atomich-into-asm-atomic_defh-update /dev/null
@@ -1,6 +0,0 @@
-#ifndef _XTENSA_ATOMIC_DEF_H
-#define _XTENSA_ATOMIC_DEF_H
-
-typedef struct { volatile int counter; } atomic_t;
-
-#endif
include/asm-xtensa/atomic_types.h new file +6 -0
diff -puN /dev/null include/asm-xtensa/atomic_types.h
@@ -0,0 +1,6 @@
+#ifndef _XTENSA_ATOMIC_TYPES_H
+#define _XTENSA_ATOMIC_TYPES_H
+
+typedef struct { volatile int counter; } atomic_t;
+
+#endif

_

#2 lore raw
Quoted 17 lines · Andrew Morton
Quoted 14 lines · On Wed, 08 Oct 2008 17:44:30 +0800 Huang Ying <[email protected]> wrote:

From: Huang Ying <[email protected]>

asm/atomic.h contains both declaration and implementation of atomic_t. So there are some implementation related files included in asm/atomic.h. And atomic_t is a typedef. Combination of above makes it impossible to use atomic_t in files included by atomic.h. Such as atomic_t can not be used in linux/kernel.h on i386, because it is included by asm/atomic.h.

It is reasonable to separate declaration from implementation. So a new file atomic_types.h is added for every architecture to accommodate the declaration of atomic_t.

Includes fixes from Andrew Moton.

Quoted 7 lines
Quoted 2 lines

The difference between what-i-currently-have and what-you-just-sent is below. It's quite large.

Can you explain this update please?

i've been giving review feedback to make it all fit into existing namespace concepts better. Should have no change in functionality. (But i have not tested it)

Ingo

#3 lore raw
Quoted 23 lines · On Fri, 10 Oct 2008 23:49:58 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 20 lines · Andrew Morton
Quoted 16 lines · On Wed, 08 Oct 2008 17:44:30 +0800 Huang Ying <[email protected]> wrote:

From: Huang Ying <[email protected]>

asm/atomic.h contains both declaration and implementation of atomic_t. So there are some implementation related files included in asm/atomic.h. And atomic_t is a typedef. Combination of above makes it impossible to use atomic_t in files included by atomic.h. Such as atomic_t can not be used in linux/kernel.h on i386, because it is included by asm/atomic.h.

It is reasonable to separate declaration from implementation. So a new file atomic_types.h is added for every architecture to accommodate the declaration of atomic_t.

Includes fixes from Andrew Moton.

Quoted 9 lines
Quoted 4 lines

The difference between what-i-currently-have and what-you-just-sent is below. It's quite large.

Can you explain this update please?

i've been giving review feedback to make it all fit into existing namespace concepts better. Should have no change in functionality. (But i have not tested it)

I have a note here that Matthew has proposed a different way of doing all this. I don't immediately recall the details.

Can we get a refresh on all of that please?

#4 lore raw
Quoted 4 lines · Andrew Morton

I have a note here that Matthew has proposed a different way of doing all this. I don't immediately recall the details.

Can we get a refresh on all of that please?

I didn't remember either, but having just reviewed my inbox from August, I said that all architectures basically use:

typedef struct { volatile int counter; } atomic_t; #ifdef CONFIG_64BIT
typedef struct { volatile long counter; } atomic64_t; #endif

and that should just be put in <linux/atomic_types.h>.

Roman Zippel did me one better and suggested just putting it in types.h, which works for me.

Signature · 4 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#5 lore raw
Quoted 14 lines · On Tue, 14 Oct 2008 12:47:19 -0600 Matthew Wilcox <[email protected]> wrote:
Quoted 4 lines · Andrew Morton

I have a note here that Matthew has proposed a different way of doing all this. I don't immediately recall the details.

Can we get a refresh on all of that please?

I didn't remember either, but having just reviewed my inbox from August, I said that all architectures basically use:

typedef struct { volatile int counter; } atomic_t; #ifdef CONFIG_64BIT
typedef struct { volatile long counter; } atomic64_t; #endif

Quoted 4 lines

and that should just be put in <linux/atomic_types.h>.

Roman Zippel did me one better and suggested just putting it in types.h, which works for me.

OK. Or we could do the usual include/asm-generic/atomic_types.h and then architectures can choose to include that if it is appropriate.

Anyway the good news is that this concept is an addition to rather than a replacement of this current patch.

#6 lore raw
Quoted 10 lines · Andrew Morton
Quoted 2 lines · On Tue, 14 Oct 2008 12:47:19 -0600 Matthew Wilcox <[email protected]> wrote:

Roman Zippel did me one better and suggested just putting it in types.h, which works for me.

OK. Or we could do the usual include/asm-generic/atomic_types.h and then architectures can choose to include that if it is appropriate.

Anyway the good news is that this concept is an addition to rather than a replacement of this current patch.

Um, no. Roman and I are against the creation of a new file. Just put the atomic_t definition in <linux/types.h>.

Signature · 4 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#7 lore raw
Quoted 6 lines · On Wed, 15 Oct 2008 16:19:48 -0600 Matthew Wilcox <[email protected]> wrote:
Quoted 5 lines · Andrew Morton
Quoted 2 lines · On Tue, 14 Oct 2008 12:47:19 -0600 Matthew Wilcox <[email protected]> wrote:

Roman Zippel did me one better and suggested just putting it in types.h, which works for me.

Quoted 8 lines
Quoted 5 lines

OK. Or we could do the usual include/asm-generic/atomic_types.h and then architectures can choose to include that if it is appropriate.

Anyway the good news is that this concept is an addition to rather than a replacement of this current patch.

Um, no. Roman and I are against the creation of a new file. Just put the atomic_t definition in <linux/types.h>.

Well we've been glacially fartarsing around with this for sufficiently long that any such alterations will be too late for 2.6.28.

I'll drop it all. Again.

#8 lore raw
Quoted 4 lines · Andrew Morton

Well we've been glacially fartarsing around with this for sufficiently long that any such alterations will be too late for 2.6.28.

I'll drop it all. Again.

Here's an updated patch which uses linux/types.h as suggested by Roman. I started fresh rather than use the original patch. I compared the diffstats afterwards and I caught one architecture the original didn't (parisc), plus the original was creating files in include/asm-*/ even for architectures that had migrated to arch/*/include/asm.

---

The atomic_t type cannot currently be used in some header files because it would create an include loop with asm/atomic.h. Move the type definition to linux/types.h to break the loop.

 arch/alpha/include/asm/atomic.h     |    9 +--------
 arch/arm/include/asm/atomic.h       |    3 +--
 arch/avr32/include/asm/atomic.h     |    2 +-
 arch/blackfin/include/asm/atomic.h  |    4 +---
 arch/h8300/include/asm/atomic.h     |    3 ++-
 arch/ia64/include/asm/atomic.h      |    6 ------
 arch/m68knommu/include/asm/atomic.h |    2 +-
 arch/mips/include/asm/atomic.h      |    5 +----
 arch/powerpc/include/asm/atomic.h   |    4 +---
 arch/s390/include/asm/atomic.h      |    7 +------
 arch/sh/include/asm/atomic.h        |    7 +++----
 arch/sparc/include/asm/atomic_32.h  |    2 --
 arch/sparc/include/asm/atomic_64.h  |    3 ---
 include/asm-cris/atomic.h           |    4 +---
 include/asm-frv/atomic.h            |    4 ----
 include/asm-m32r/atomic.h           |    8 +-------
 include/asm-m68k/atomic.h           |    3 +--
 include/asm-mn10300/atomic.h        |    9 ---------
 include/asm-parisc/atomic.h         |   11 +++--------
 include/asm-x86/atomic_32.h         |   10 +---------
 include/asm-x86/atomic_64.h         |   18 ++----------------
 include/asm-xtensa/atomic.h         |    3 +--
 include/linux/types.h               |   10 ++++++++++
 23 files changed, 33 insertions(+), 104 deletions(-)
arch/alpha/include/asm/atomic.h +1 -8
index ca88e54..62b3635 100644
@@ -1,6 +1,7 @@
 #ifndef _ALPHA_ATOMIC_H
 #define _ALPHA_ATOMIC_H
 
+#include <linux/types.h>
 #include <asm/barrier.h>
 #include <asm/system.h>
 
@@ -13,14 +14,6 @@
  */
 
 
-/*
- * Counter is volatile to make sure gcc doesn't try to be clever
- * and move things around on us. We need to use _exactly_ the address
- * the user gave us, not some alias that contains the same information.
- */
-typedef struct { volatile int counter; } atomic_t;
-typedef struct { volatile long counter; } atomic64_t;
-
 #define ATOMIC_INIT(i)		( (atomic_t) { (i) } )
 #define ATOMIC64_INIT(i)	( (atomic64_t) { (i) } )
 
arch/arm/include/asm/atomic.h +1 -2
index 325f881..ee99723 100644
@@ -12,10 +12,9 @@
 #define __ASM_ARM_ATOMIC_H
 
 #include <linux/compiler.h>
+#include <linux/types.h>
 #include <asm/system.h>
 
-typedef struct { volatile int counter; } atomic_t;
-
 #define ATOMIC_INIT(i)	{ (i) }
 
 #ifdef __KERNEL__
arch/avr32/include/asm/atomic.h +1 -1
index 7ef3862..3188151 100644
@@ -14,9 +14,9 @@
 #ifndef __ASM_AVR32_ATOMIC_H
 #define __ASM_AVR32_ATOMIC_H
 
+#include <linux/types.h>
 #include <asm/system.h>
 
-typedef struct { volatile int counter; } atomic_t;
 #define ATOMIC_INIT(i)  { (i) }
 
 #define atomic_read(v)		((v)->counter)
arch/blackfin/include/asm/atomic.h +1 -3
index 7cf5087..25776c1 100644
@@ -1,6 +1,7 @@
 #ifndef __ARCH_BLACKFIN_ATOMIC__
 #define __ARCH_BLACKFIN_ATOMIC__
 
+#include <linux/types.h>
 #include <asm/system.h>	/* local_irq_XXX() */
 
 /*
@@ -13,9 +14,6 @@
  * Tony Kou ([email protected])   Lineo Inc.   2001
  */
 
-typedef struct {
-	int counter;
-} atomic_t;
 #define ATOMIC_INIT(i)	{ (i) }
 
 #define atomic_read(v)		((v)->counter)
arch/h8300/include/asm/atomic.h +2 -1
index b4cf0ea..833186c 100644
@@ -1,12 +1,13 @@
 #ifndef __ARCH_H8300_ATOMIC__
 #define __ARCH_H8300_ATOMIC__
 
+#include <linux/types.h>
+
 /*
  * Atomic operations that C can't guarantee us.  Useful for
  * resource counting etc..
  */
 
-typedef struct { int counter; } atomic_t;
 #define ATOMIC_INIT(i)	{ (i) }
 
 #define atomic_read(v)		((v)->counter)
arch/ia64/include/asm/atomic.h +0 -6
index 50c2b83..d37292b 100644
@@ -17,12 +17,6 @@
 #include <asm/intrinsics.h>
 #include <asm/system.h>
 
-/*
- * On IA-64, counter must always be volatile to ensure that that the
- * memory accesses are ordered.
- */
-typedef struct { volatile __s32 counter; } atomic_t;
-typedef struct { volatile __s64 counter; } atomic64_t;
 
 #define ATOMIC_INIT(i)		((atomic_t) { (i) })
 #define ATOMIC64_INIT(i)	((atomic64_t) { (i) })
arch/m68knommu/include/asm/atomic.h +1 -1
index d5632a3..6bb6748 100644
@@ -1,6 +1,7 @@
 #ifndef __ARCH_M68KNOMMU_ATOMIC__
 #define __ARCH_M68KNOMMU_ATOMIC__
 
+#include <linux/types.h>
 #include <asm/system.h>
 
 /*
@@ -12,7 +13,6 @@
  * We do not have SMP m68k systems, so we don't have to deal with that.
  */
 
-typedef struct { int counter; } atomic_t;
 #define ATOMIC_INIT(i)	{ (i) }
 
 #define atomic_read(v)		((v)->counter)
arch/mips/include/asm/atomic.h +1 -4
index 1232be3..c996c3b 100644
@@ -15,13 +15,12 @@
 #define _ASM_ATOMIC_H
 
 #include <linux/irqflags.h>
+#include <linux/types.h>
 #include <asm/barrier.h>
 #include <asm/cpu-features.h>
 #include <asm/war.h>
 #include <asm/system.h>
 
-typedef struct { volatile int counter; } atomic_t;
-
 #define ATOMIC_INIT(i)    { (i) }
 
 /*
@@ -404,8 +403,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
 
 #ifdef CONFIG_64BIT
 
-typedef struct { volatile long counter; } atomic64_t;
-
 #define ATOMIC64_INIT(i)    { (i) }
 
 /*
arch/powerpc/include/asm/atomic.h +1 -3
index f3fc733..9c74e6d 100644
@@ -5,7 +5,7 @@
  * PowerPC atomic operations
  */
 
-typedef struct { int counter; } atomic_t;
+#include <linux/types.h>
 
 #ifdef __KERNEL__
 #include <linux/compiler.h>
@@ -251,8 +251,6 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v)
 
 #ifdef __powerpc64__
 
-typedef struct { long counter; } atomic64_t;
-
 #define ATOMIC64_INIT(i)	{ (i) }
 
 static __inline__ long atomic64_read(const atomic64_t *v)
arch/s390/include/asm/atomic.h +1 -6
index 2d18465..de432f2 100644
@@ -2,6 +2,7 @@
 #define __ARCH_S390_ATOMIC__
 
 #include <linux/compiler.h>
+#include <linux/types.h>
 
 /*
  *  include/asm-s390/atomic.h
@@ -23,9 +24,6 @@
  * S390 uses 'Compare And Swap' for atomicity in SMP enviroment
  */
 
-typedef struct {
-	int counter;
-} __attribute__ ((aligned (4))) atomic_t;
 #define ATOMIC_INIT(i)  { (i) }
 
 #ifdef __KERNEL__
@@ -149,9 +147,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
 #undef __CS_LOOP
 
 #ifdef __s390x__
-typedef struct {
-	long long counter;
-} __attribute__ ((aligned (8))) atomic64_t;
 #define ATOMIC64_INIT(i)  { (i) }
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
arch/sh/include/asm/atomic.h +3 -4
index c043ef0..6327ffb 100644
@@ -7,16 +7,15 @@
  *
  */
 
-typedef struct { volatile int counter; } atomic_t;
+#include <linux/compiler.h>
+#include <linux/types.h>
+#include <asm/system.h>
 
 #define ATOMIC_INIT(i)	( (atomic_t) { (i) } )
 
 #define atomic_read(v)		((v)->counter)
 #define atomic_set(v,i)		((v)->counter = (i))
 
-#include <linux/compiler.h>
-#include <asm/system.h>
-
 #if defined(CONFIG_GUSA_RB)
 #include <asm/atomic-grb.h>
 #elif defined(CONFIG_CPU_SH4A)
arch/sparc/include/asm/atomic_32.h +0 -2
index 5c944b5..ce46597 100644
@@ -13,8 +13,6 @@
 
 #include <linux/types.h>
 
-typedef struct { volatile int counter; } atomic_t;
-
 #ifdef __KERNEL__
 
 #define ATOMIC_INIT(i)  { (i) }
arch/sparc/include/asm/atomic_64.h +0 -3
index 2c71ec4..f432a4e 100644
@@ -10,9 +10,6 @@
 #include <linux/types.h>
 #include <asm/system.h>
 
-typedef struct { volatile int counter; } atomic_t;
-typedef struct { volatile __s64 counter; } atomic64_t;
-
 #define ATOMIC_INIT(i)		{ (i) }
 #define ATOMIC64_INIT(i)	{ (i) }
 
include/asm-cris/atomic.h +1 -3
index 5fc8776..3293a6a 100644
@@ -4,7 +4,7 @@
 #define __ASM_CRIS_ATOMIC__
 
 #include <linux/compiler.h>
-
+#include <linux/types.h>
 #include <asm/system.h>
 #include <asm/arch/atomic.h>
 
@@ -13,8 +13,6 @@
  * resource counting etc..
  */
 
-typedef struct { volatile int counter; } atomic_t;
-
 #define ATOMIC_INIT(i)  { (i) }
 
 #define atomic_read(v) ((v)->counter)
include/asm-frv/atomic.h +0 -4
index 46d696b..296c35c 100644
@@ -35,10 +35,6 @@
 #define smp_mb__before_atomic_inc()	barrier()
 #define smp_mb__after_atomic_inc()	barrier()
 
-typedef struct {
-	int counter;
-} atomic_t;
-
 #define ATOMIC_INIT(i)		{ (i) }
 #define atomic_read(v)		((v)->counter)
 #define atomic_set(v, i)	(((v)->counter) = (i))
include/asm-m32r/atomic.h +1 -7
index 3a38ffe..2eed30f 100644
@@ -9,6 +9,7 @@
  *    Copyright (C) 2004  Hirokazu Takata <takata at linux-m32r.org>
  */
 
+#include <linux/types.h>
 #include <asm/assembler.h>
 #include <asm/system.h>
 
@@ -17,13 +18,6 @@
  * resource counting etc..
  */
 
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct { volatile int counter; } atomic_t;
-
 #define ATOMIC_INIT(i)	{ (i) }
 
 /**
include/asm-m68k/atomic.h +1 -2
index 4915294..eb0ab9d 100644
@@ -1,7 +1,7 @@
 #ifndef __ARCH_M68K_ATOMIC__
 #define __ARCH_M68K_ATOMIC__
 
-
+#include <linux/types.h>
 #include <asm/system.h>
 
 /*
@@ -13,7 +13,6 @@
  * We do not have SMP m68k systems, so we don't have to deal with that.
  */
 
-typedef struct { int counter; } atomic_t;
 #define ATOMIC_INIT(i)	{ (i) }
 
 #define atomic_read(v)		((v)->counter)
include/asm-mn10300/atomic.h +0 -9
index 27c9690..bc06482 100644
@@ -20,15 +20,6 @@
  * resource counting etc..
  */
 
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct {
-	int	counter;
-} atomic_t;
-
 #define ATOMIC_INIT(i)	{ (i) }
 
 #ifdef __KERNEL__
include/asm-parisc/atomic.h +3 -8
index 57fcc4a..edbfe25 100644
@@ -155,14 +155,11 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
 #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
 #endif
 
-/* Note that we need not lock read accesses - aligned word writes/reads
- * are atomic, so a reader never sees unconsistent values.
- *
- * Cache-line alignment would conflict with, for example, linux/module.h
+/*
+ * Note that we need not lock read accesses - aligned word writes/reads
+ * are atomic, so a reader never sees inconsistent values.
  */
 
-typedef struct { volatile int counter; } atomic_t;
-
 /* It's possible to reduce all atomic operations to either
  * __atomic_add_return, atomic_set and atomic_read (the latter
  * is there only for consistency).
@@ -260,8 +257,6 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
 
 #ifdef CONFIG_64BIT
 
-typedef struct { volatile s64 counter; } atomic64_t;
-
 #define ATOMIC64_INIT(i) ((atomic64_t) { (i) })
 
 static __inline__ int
include/asm-x86/atomic_32.h +1 -9
index 14d3f0b..f3b37f8 100644
@@ -2,6 +2,7 @@
 #define ASM_X86__ATOMIC_32_H
 
 #include <linux/compiler.h>
+#include <linux/types.h>
 #include <asm/processor.h>
 #include <asm/cmpxchg.h>
 
@@ -10,15 +11,6 @@
  * resource counting etc..
  */
 
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct {
-	int counter;
-} atomic_t;
-
 #define ATOMIC_INIT(i)	{ (i) }
 
 /**
include/asm-x86/atomic_64.h +2 -16
index 2cb218c..acd07a5 100644
@@ -1,25 +1,15 @@
 #ifndef ASM_X86__ATOMIC_64_H
 #define ASM_X86__ATOMIC_64_H
 
+#include <linux/types.h>
 #include <asm/alternative.h>
 #include <asm/cmpxchg.h>
 
-/* atomic_t should be 32 bit signed type */
-
 /*
  * Atomic operations that C can't guarantee us.  Useful for
  * resource counting etc..
  */
 
-/*
- * Make sure gcc doesn't try to be clever and move things around
- * on us. We need to use _exactly_ the address the user gave us,
- * not some alias that contains the same information.
- */
-typedef struct {
-	int counter;
-} atomic_t;
-
 #define ATOMIC_INIT(i)	{ (i) }
 
 /**
@@ -191,11 +181,7 @@ static inline int atomic_sub_return(int i, atomic_t *v)
 #define atomic_inc_return(v)  (atomic_add_return(1, v))
 #define atomic_dec_return(v)  (atomic_sub_return(1, v))
 
-/* An 64bit atomic type */
-
-typedef struct {
-	long counter;
-} atomic64_t;
+/* The 64-bit atomic type */
 
 #define ATOMIC64_INIT(i)	{ (i) }
 
include/asm-xtensa/atomic.h +1 -2
index b3b2354..67ad67b 100644
@@ -14,8 +14,7 @@
 #define _XTENSA_ATOMIC_H
 
 #include <linux/stringify.h>
-
-typedef struct { volatile int counter; } atomic_t;
+#include <linux/types.h>
 
 #ifdef __KERNEL__
 #include <asm/processor.h>
include/linux/types.h +10 -0
index f24f7be..400df51 100644
@@ -199,6 +199,16 @@ typedef u32 phys_addr_t;
 
 typedef phys_addr_t resource_size_t;
 
+typedef struct {
+	volatile int counter;
+} atomic_t;
+
+#ifdef CONFIG_64BIT
+typedef struct {
+	volatile long counter;
+} atomic64_t;
+#endif
+
 struct ustat {
 	__kernel_daddr_t	f_tfree;
 	__kernel_ino_t		f_tinode;
Signature · 4 lines
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."