Cleanup non-atomic bit operation

From: Chen, Kenneth W <kenneth.w.chen_at_intel.com>
Date: 2006-03-29 12:06:25
Non-atomic version of __clear_bit uses volatile declaration, which turned
into an expensive ordered operation.  Fixed that up.  Also fix up cosmetic
function declaration for other non-atomic bit ops.


Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>


--- ./include/asm-ia64/bitops.h.orig	2006-03-28 17:53:48.000000000 -0800
+++ ./include/asm-ia64/bitops.h	2006-03-28 17:57:45.000000000 -0800
@@ -57,7 +57,7 @@ set_bit (int nr, volatile void *addr)
  * may be that only one operation succeeds.
  */
 static __inline__ void
-__set_bit (int nr, volatile void *addr)
+__set_bit (int nr, void *addr)
 {
 	*((__u32 *) addr + (nr >> 5)) |= (1 << (nr & 31));
 }
@@ -98,11 +98,9 @@ clear_bit (int nr, volatile void *addr)
  * __clear_bit - Clears a bit in memory (non-atomic version)
  */
 static __inline__ void
-__clear_bit (int nr, volatile void *addr)
+__clear_bit (int nr, void *addr)
 {
-	volatile __u32 *p = (__u32 *) addr + (nr >> 5);
-	__u32 m = 1 << (nr & 31);
-	*p &= ~m;
+	*((__u32 *) addr + (nr >> 5)) &= ~(1 << (nr & 31));
 }
 
 /**
@@ -140,7 +138,7 @@ change_bit (int nr, volatile void *addr)
  * may be that only one operation succeeds.
  */
 static __inline__ void
-__change_bit (int nr, volatile void *addr)
+__change_bit (int nr, void *addr)
 {
 	*((__u32 *) addr + (nr >> 5)) ^= (1 << (nr & 31));
 }
@@ -180,7 +178,7 @@ test_and_set_bit (int nr, volatile void 
  * but actually fail.  You must protect multiple accesses with a lock.
  */
 static __inline__ int
-__test_and_set_bit (int nr, volatile void *addr)
+__test_and_set_bit (int nr, void *addr)
 {
 	__u32 *p = (__u32 *) addr + (nr >> 5);
 	__u32 m = 1 << (nr & 31);
@@ -225,7 +223,7 @@ test_and_clear_bit (int nr, volatile voi
  * but actually fail.  You must protect multiple accesses with a lock.
  */
 static __inline__ int
-__test_and_clear_bit(int nr, volatile void * addr)
+__test_and_clear_bit(int nr, void * addr)
 {
 	__u32 *p = (__u32 *) addr + (nr >> 5);
 	__u32 m = 1 << (nr & 31);

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Mar 29 12:21:58 2006

This archive was generated by hypermail 2.1.8 : 2006-03-29 12:22:11 EST