Commit 1ef1c80f authored by Alexander Kartashov's avatar Alexander Kartashov Committed by Pavel Emelyanov

arm: bitops: fixed bitops to access more than 32 bits

Signed-off-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c97911a5
...@@ -20,22 +20,26 @@ ...@@ -20,22 +20,26 @@
#define ADDR BITOP_ADDR(addr) #define ADDR BITOP_ADDR(addr)
static inline void set_bit(int nr, volatile unsigned long *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) 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) 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) 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));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment