patch-2.3.48 linux/include/asm-mips/bitops.h

Next file: linux/include/asm-mips/bootinfo.h
Previous file: linux/include/asm-mips/bcache.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.47/linux/include/asm-mips/bitops.h linux/include/asm-mips/bitops.h
@@ -1,22 +1,22 @@
-/*
- * include/asm-mips/bitops.h
+/* $Id: bitops.h,v 1.7 1999/08/19 22:56:33 ralf Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 1994 - 1997  Ralf Baechle (ralf@gnu.org)
+ * Copyright (c) 1994 - 1997, 1999  Ralf Baechle (ralf@gnu.org)
  */
-#ifndef __ASM_MIPS_BITOPS_H
-#define __ASM_MIPS_BITOPS_H
+#ifndef _ASM_BITOPS_H
+#define _ASM_BITOPS_H
 
 #include <linux/types.h>
-#include <linux/byteorder/swab.h>		/* sigh ... */
+#include <asm/byteorder.h>		/* sigh ... */
 
 #ifdef __KERNEL__
 
 #include <asm/sgidefs.h>
 #include <asm/system.h>
+#include <linux/config.h>
 
 /*
  * Only disable interrupt for kernel mode stuff to keep usermode stuff
@@ -25,11 +25,13 @@
 #define __bi_flags unsigned long flags
 #define __bi_cli() __cli()
 #define __bi_save_flags(x) __save_flags(x)
+#define __bi_save_and_cli(x) __save_and_cli(x)
 #define __bi_restore_flags(x) __restore_flags(x)
 #else
 #define __bi_flags
 #define __bi_cli()
 #define __bi_save_flags(x)
+#define __bi_save_and_cli(x)
 #define __bi_restore_flags(x)
 #endif /* __KERNEL__ */
 
@@ -52,8 +54,7 @@
 extern __inline__ int find_next_zero_bit (void * addr, int size, int offset);
 extern __inline__ unsigned long ffz(unsigned long word);
 
-#if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) || \
-    (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5)
+#if defined(CONFIG_CPU_HAS_LLSC)
 
 /*
  * These functions for MIPS ISA > 1 are interrupt and SMP proof and
@@ -144,6 +145,8 @@
 
 #else /* MIPS I */
 
+#include <asm/mipsregs.h>
+
 extern __inline__ void set_bit(int nr, void * addr)
 {
 	int	mask;
@@ -152,8 +155,7 @@
 
 	a += nr >> 5;
 	mask = 1 << (nr & 0x1f);
-	__bi_save_flags(flags);
-	__bi_cli();
+	__bi_save_and_cli(flags);
 	*a |= mask;
 	__bi_restore_flags(flags);
 }
@@ -166,8 +168,7 @@
 
 	a += nr >> 5;
 	mask = 1 << (nr & 0x1f);
-	__bi_save_flags(flags);
-	__bi_cli();
+	__bi_save_and_cli(flags);
 	*a &= ~mask;
 	__bi_restore_flags(flags);
 }
@@ -180,8 +181,7 @@
 
 	a += nr >> 5;
 	mask = 1 << (nr & 0x1f);
-	__bi_save_flags(flags);
-	__bi_cli();
+	__bi_save_and_cli(flags);
 	*a ^= mask;
 	__bi_restore_flags(flags);
 }
@@ -194,8 +194,7 @@
 
 	a += nr >> 5;
 	mask = 1 << (nr & 0x1f);
-	__bi_save_flags(flags);
-	__bi_cli();
+	__bi_save_and_cli(flags);
 	retval = (mask & *a) != 0;
 	*a |= mask;
 	__bi_restore_flags(flags);
@@ -211,8 +210,7 @@
 
 	a += nr >> 5;
 	mask = 1 << (nr & 0x1f);
-	__bi_save_flags(flags);
-	__bi_cli();
+	__bi_save_and_cli(flags);
 	retval = (mask & *a) != 0;
 	*a &= ~mask;
 	__bi_restore_flags(flags);
@@ -228,8 +226,7 @@
 
 	a += nr >> 5;
 	mask = 1 << (nr & 0x1f);
-	__bi_save_flags(flags);
-	__bi_cli();
+	__bi_save_and_cli(flags);
 	retval = (mask & *a) != 0;
 	*a ^= mask;
 	__bi_restore_flags(flags);
@@ -457,7 +454,7 @@
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	save_flags(flags); cli();
+	save_and_cli(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR |= mask;
 	restore_flags(flags);
@@ -471,7 +468,7 @@
 
 	ADDR += nr >> 3;
 	mask = 1 << (nr & 0x07);
-	save_flags(flags); cli();
+	save_and_cli(flags);
 	retval = (mask & *ADDR) != 0;
 	*ADDR &= ~mask;
 	restore_flags(flags);
@@ -562,4 +559,4 @@
 #define minix_test_bit(nr,addr) test_bit(nr,addr)
 #define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
 
-#endif /* __ASM_MIPS_BITOPS_H */
+#endif /* _ASM_BITOPS_H */

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