Skip to contentSkip to conversation

arm: boolean bit testing

PATCH New Johannes Weiner 1 participant 1 message Jul 21, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: boolean bit testing

Bit testing (test, testset, testclear, testchange) for bit numbers known at compile time returns a word with the tested-for bit set.

Change it to return a true boolean value so to make it consistent with the out-of-line path and all the other bitops implementations.

---
 arch/arm/include/asm/bitops.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

My limited ARM asm-foo says that the testop macro functions properly already. Please double check.

arch/arm/include/asm/bitops.h +3 -3
index 63a481f..338ff19 100644
@@ -84,7 +84,7 @@ ____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p)
 	*p = res | mask;
 	raw_local_irq_restore(flags);
 
-	return res & mask;
+	return (res & mask) != 0;
 }
 
 static inline int
@@ -101,7 +101,7 @@ ____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
 	*p = res & ~mask;
 	raw_local_irq_restore(flags);
 
-	return res & mask;
+	return (res & mask) != 0;
 }
 
 static inline int
@@ -118,7 +118,7 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
 	*p = res ^ mask;
 	raw_local_irq_restore(flags);
 
-	return res & mask;
+	return (res & mask) != 0;
 }
 
 #include <asm-generic/bitops/non-atomic.h>
Signature · 1 line
1.6.3