patch-2.4.22 linux-2.4.22/include/asm-mips/atomic.h

Next file: linux-2.4.22/include/asm-mips/au1000.h
Previous file: linux-2.4.22/include/asm-mips/asmmacro.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.21/include/asm-mips/atomic.h linux-2.4.22/include/asm-mips/atomic.h
@@ -59,9 +59,9 @@
 {
 	unsigned long flags;
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 	v->counter += i;
-	restore_flags(flags);
+	local_irq_restore(flags);
 }
 
 /*
@@ -76,9 +76,9 @@
 {
 	unsigned long flags;
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 	v->counter -= i;
-	restore_flags(flags);
+	local_irq_restore(flags);
 }
 
 extern __inline__ int atomic_add_return(int i, atomic_t * v)
@@ -86,11 +86,11 @@
 	unsigned long flags;
 	int temp;
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 	temp = v->counter;
 	temp += i;
 	v->counter = temp;
-	restore_flags(flags);
+	local_irq_restore(flags);
 
 	return temp;
 }
@@ -100,11 +100,11 @@
 	unsigned long flags;
 	int temp;
 
-	save_and_cli(flags);
+	local_irq_save(flags);
 	temp = v->counter;
 	temp -= i;
 	v->counter = temp;
-	restore_flags(flags);
+	local_irq_restore(flags);
 
 	return temp;
 }
@@ -228,7 +228,7 @@
  * other cases.  Note that the guaranteed
  * useful range of an atomic_t is only 24 bits.
  */
-#define atomic_inc_and_test(v) (atomic_inc_return(1, (v)) == 0)
+#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
 
 /*
  * atomic_dec_and_test - decrement by 1 and test
@@ -268,9 +268,8 @@
  * if the result is negative, or false when
  * result is greater than or equal to zero.  Note that the guaranteed
  * useful range of an atomic_t is only 24 bits.
- *
- * Currently not implemented for MIPS.
  */
+#define atomic_add_negative(i,v) (atomic_add_return(i, (v)) < 0)
 
 /* Atomic operations are already serializing */
 #define smp_mb__before_atomic_dec()	smp_mb()

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