[CRIU] [PATCH] arm: bitops: fixed bitops to access more than 32 bits

Alexander Kartashov alekskartashov at parallels.com
Thu Jun 13 10:24:13 EDT 2013


Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 arch/arm/include/asm/bitops.h |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index dffb6de..cf42235 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -20,22 +20,26 @@
 #define ADDR				BITOP_ADDR(addr)
 
 static inline void set_bit(int nr, volatile unsigned long *addr) {
-	*addr |= (1 << nr);
+	addr += nr / BITS_PER_LONG;
+	*addr |= (1 << (nr % BITS_PER_LONG));
 }
 
 static inline void change_bit(int nr, volatile unsigned long *addr)
 {
-	*addr ^= (1 << nr);
+	addr += nr / BITS_PER_LONG;
+	*addr ^= (1 << (nr % BITS_PER_LONG));
 }
 
 static inline int test_bit(int nr, volatile const unsigned long *addr)
 {
-	return (*addr & (1 << nr)) ? -1 : 0;
+	addr += nr / BITS_PER_LONG;
+	return (*addr & (1 << (nr % BITS_PER_LONG))) ? -1 : 0;
 }
 
 static inline void clear_bit(int nr, volatile unsigned long *addr)
 {
-	*addr &= ~(1 << nr);
+	addr += nr / BITS_PER_LONG;
+	*addr &= ~(1 << (nr % BITS_PER_LONG));
 }
 
 /**
-- 
1.7.10.4



More information about the CRIU mailing list