mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] arm: boolean bit testing
@ 2009-07-21 15:08 Johannes Weiner
  0 siblings, 0 replies; only message in thread
From: Johannes Weiner @ 2009-07-21 15:08 UTC (permalink / raw)
  To: linux; +Cc: linux-kernel

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.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 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.

diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index 63a481f..338ff19 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -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>
-- 
1.6.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-21 15:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-21 15:08 [patch] arm: boolean bit testing Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®