bitops: Change the bitmap index from int to unsigned long [generic]
Subsystems (2)
PATCH 1/15 bitops: Change the bitmap index from int to unsigned long [generic]
Change the index to unsigned long in all bitops for [generic]
Signed-off-by Justin Chen <[email protected]>
Reviewed-by Bjorn Helgaas <[email protected]>
--- include/asm-generic/bitops/atomic.h | 17 ++++++++++------- include/asm-generic/bitops/non-atomic.h | 19 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-)
include/asm-generic/bitops/atomic.h +10 -7
@@ -61,7 +61,7 @@* Note that @nr may be almost arbitrarily large; this function is not * restricted to acting on a single-word quantity. */ -static inline void set_bit (int nr,volatile unsigned long *addr) +static inline void set_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -82,7 +82,7 @@* you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() * in order to ensure changes are visible on other processors. */ -static inline void clear_bit (int nr,volatile unsigned long *addr) +static inline void clear_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -103,7 +103,7 @@* Note that @nr may be almost arbitrarily large; this function is not * restricted to acting on a single-word quantity. */ -static inline void change_bit (int nr,volatile unsigned long *addr) +static inline void change_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -123,7 +123,8 @@* It may be reordered on other architectures than x86. * It also implies a memory barrier. */ -static inline int test_and_set_bit (int nr,volatile unsigned long *addr) +static inline int +test_and_set_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -144,10 +145,11 @@* @addr: Address to count from * * This operation is atomic and cannot be reordered. -* It can be reorderdered on other architectures other than x86. +* It can be reordered on architectures other than x86. * It also implies a memory barrier. */ -static inline int test_and_clear_bit (int nr,volatile unsigned long *addr) +static inline int +test_and_clear_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -170,7 +172,8 @@* This operation is atomic and cannot be reordered. * It also implies a memory barrier. */ -static inline int test_and_change_bit (int nr,volatile unsigned long *addr) +static inline int +test_and_change_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
include/asm-generic/bitops/non-atomic.h +11 -8
@@ -12,7 +12,7 @@* If it's called on the same region of memory simultaneously, the effect * may be that only one operation succeeds. */ -static inline void __set_bit (int nr,volatile unsigned long *addr) +static inline void __set_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -20,7 +20,7 @@ *p |= mask; } -static inline void __clear_bit (int nr,volatile unsigned long *addr) +static inline void __clear_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -37,7 +37,7 @@* If it's called on the same region of memory simultaneously, the effect * may be that only one operation succeeds. */ -static inline void __change_bit (int nr,volatile unsigned long *addr) +static inline void __change_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -54,7 +54,8 @@* If two examples of this operation race, one can appear to succeed * but actually fail. You must protect multiple accesses with a lock. */ -static inline int __test_and_set_bit (int nr,volatile unsigned long *addr) +static inline int +__test_and_set_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -73,7 +74,8 @@* If two examples of this operation race, one can appear to succeed * but actually fail. You must protect multiple accesses with a lock. */ -static inline int __test_and_clear_bit (int nr,volatile unsigned long *addr) +static inline int +__test_and_clear_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -84,8 +86,8 @@ }/* WARNING: non atomic and it can be reordered! */ -static inline int __test_and_change_bit (int nr, -volatile unsigned long *addr) +static inline int +__test_and_change_bit (unsigned long nr,volatile unsigned long *addr) {unsigned long mask =BIT_MASK (nr);unsigned long *p = ((unsigned long *)addr) +BIT_WORD (nr);
@@ -100,7 +102,8 @@* @nr: bit number to test * @addr: Address to start counting from */ -static inline int test_bit (int nr,const volatile unsigned long *addr) +static inline int +test_bit (unsigned long nr,const volatile unsigned long *addr) {return 1UL & (addr[BIT_WORD (nr)] >> (nr & (BITS_PER_LONG -1 ))); }