patch-2.2.4 linux/include/asm-sparc/atomic.h

Next file: linux/include/asm-sparc/cache.h
Previous file: linux/include/asm-sparc/asm_offsets.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.3/linux/include/asm-sparc/atomic.h linux/include/asm-sparc/atomic.h
@@ -9,16 +9,22 @@
 #ifdef __SMP__
 /* This is a temporary measure. -DaveM */
 typedef struct { volatile int counter; } atomic_t;
+#define ATOMIC_INIT(i)	{ (i << 8) }
 #else
 typedef struct { int counter; } atomic_t;
+#define ATOMIC_INIT(i)  { (i) }
 #endif
 
-#define ATOMIC_INIT(i)	{ (i << 8) }
-
 #ifdef __KERNEL__
 #include <asm/system.h>
 #include <asm/psr.h>
 
+#ifndef __SMP__
+
+#define atomic_read(v)          ((v)->counter)
+#define atomic_set(v, i)        (((v)->counter) = i)
+
+#else
 /* We do the bulk of the actual work out of line in two common
  * routines in assembler, see arch/sparc/lib/atomic.S for the
  * "fun" details.
@@ -43,6 +49,7 @@
 	return val;
 }
 #define atomic_set(v, i)	(((v)->counter) = ((i) << 8))
+#endif
 
 /* 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,

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)