From 1ef1c80f3d03bd481b3e7de04db78d9f9122c8c5 Mon Sep 17 00:00:00 2001 From: Alexander Kartashov Date: Sat, 22 Jun 2013 13:16:43 +0400 Subject: [PATCH] arm: bitops: fixed bitops to access more than 32 bits Signed-off-by: Alexander Kartashov Signed-off-by: Pavel Emelyanov --- 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 dffb6de99..cf42235a0 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)); } /**