patch-2.4.5 linux/include/asm-alpha/bitops.h

Next file: linux/include/asm-alpha/compiler.h
Previous file: linux/fs/umsdos/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/include/asm-alpha/bitops.h linux/include/asm-alpha/bitops.h
@@ -46,7 +46,7 @@
 {
 	int *m = ((int *) addr) + (nr >> 5);
 
-	*m |= 1UL << (nr & 31);
+	*m |= 1 << (nr & 31);
 }
 
 #define smp_mb__before_clear_bit()	smp_mb()
@@ -70,6 +70,17 @@
 	:"Ir" (~(1UL << (nr & 31))), "m" (*m));
 }
 
+/*
+ * WARNING: non atomic version.
+ */
+static __inline__ void
+__change_bit(unsigned long nr, volatile void * addr)
+{
+	int *m = ((int *) addr) + (nr >> 5);
+
+	*m ^= 1 << (nr & 31);
+}
+
 extern __inline__ void
 change_bit(unsigned long nr, volatile void * addr)
 {
@@ -167,6 +178,20 @@
 	int old = *m;
 
 	*m = old & ~mask;
+	return (old & mask) != 0;
+}
+
+/*
+ * WARNING: non atomic version.
+ */
+static __inline__ int
+__test_and_change_bit(unsigned long nr, volatile void * addr)
+{
+	unsigned long mask = 1 << (nr & 0x1f);
+	int *m = ((int *) addr) + (nr >> 5);
+	int old = *m;
+
+	*m = old ^ mask;
 	return (old & mask) != 0;
 }
 

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