patch-2.4.22 linux-2.4.22/include/asm-cris/bitops.h

Next file: linux-2.4.22/include/asm-cris/bugs.h
Previous file: linux-2.4.22/include/asm-cris/atomic.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/include/asm-cris/bitops.h linux-2.4.22/include/asm-cris/bitops.h
@@ -42,6 +42,7 @@
  */
 
 #define set_bit(nr, addr)    (void)test_and_set_bit(nr, addr)
+#define __set_bit(nr, addr)    (void)__test_and_set_bit(nr, addr)
 
 /*
  * clear_bit - Clears a bit in memory
@@ -55,6 +56,7 @@
  */
 
 #define clear_bit(nr, addr)  (void)test_and_clear_bit(nr, addr)
+#define __clear_bit(nr, addr)  (void)__test_and_clear_bit(nr, addr)
 
 /*
  * change_bit - Toggle a bit in memory
@@ -105,6 +107,18 @@
 	return retval;
 }
 
+extern inline int __test_and_set_bit(int nr, void *addr)
+{
+	unsigned int mask, retval;
+	unsigned int *adr = (unsigned int *)addr;
+	
+	adr += nr >> 5;
+	mask = 1 << (nr & 0x1f);
+	retval = (mask & *adr) != 0;
+	*adr |= mask;
+	return retval;
+}
+
 /*
  * clear_bit() doesn't provide any barrier for the compiler.
  */

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