summaryrefslogtreecommitdiffstats
path: root/include/asm-mips/atomic.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-06-25 20:51:39 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-06-25 20:51:39 +0000
commitccc82a1e267548fd4d7281788c63628c4c84600d (patch)
tree0473708b07a0bb5863dddebc5d7d57a778486c64 /include/asm-mips/atomic.h
parent2c42e02b46e196435cfbad5fb2135558dbe7ce93 (diff)
Don't export all symbols to userland for sake of some user code.
Diffstat (limited to 'include/asm-mips/atomic.h')
-rw-r--r--include/asm-mips/atomic.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index 7b1187768..d9f5fe48c 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -10,25 +10,21 @@
* for more details.
*
* Copyright (C) 1996 by Ralf Baechle
+ *
+ * $Id: atomic.h,v 1.2 1997/06/20 03:05:12 ralf Exp $
*/
#ifndef __ASM_MIPS_ATOMIC_H
#define __ASM_MIPS_ATOMIC_H
#include <asm/sgidefs.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.
- */
-#define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x)
-
#ifdef __SMP__
typedef struct { volatile int counter; } atomic_t;
#else
typedef struct { int counter; } atomic_t;
#endif
+#ifdef __KERNEL__
#define ATOMIC_INIT(i) { (i) }
#define atomic_read(v) ((v)->counter)
@@ -97,6 +93,14 @@ extern __inline__ int atomic_sub_return(int i, atomic_t * v)
* ... while for MIPS II and better we can use ll/sc instruction. This
* implementation is SMP safe ...
*/
+
+/*
+ * 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.
+ */
+#define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x)
+
extern __inline__ void atomic_add(int i, volatile atomic_t * v)
{
unsigned long temp;
@@ -181,5 +185,6 @@ extern __inline__ int atomic_sub_return(int i, atomic_t * v)
#define atomic_inc(v) atomic_add(1,(v))
#define atomic_dec(v) atomic_sub(1,(v))
+#endif /* defined(__KERNEL__) */
#endif /* __ASM_MIPS_ATOMIC_H */