diff options
author | Simon Kagstrom <simon.kagstrom@netinsight.net> | 2009-08-24 09:10:16 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-09-15 22:35:20 +0200 |
commit | a6e19d69f63c14b7672c65ca4b014621c6fd0201 (patch) | |
tree | 2edb6ced483b7fc895ae2e38bbf93a4102e4f427 /include/asm-arm/bitops.h | |
parent | 52d61227b66d4099b39c8309ab37cb67ee09a405 (diff) | |
download | u-boot-imx-a6e19d69f63c14b7672c65ca4b014621c6fd0201.zip u-boot-imx-a6e19d69f63c14b7672c65ca4b014621c6fd0201.tar.gz u-boot-imx-a6e19d69f63c14b7672c65ca4b014621c6fd0201.tar.bz2 |
arm: Define test_and_set_bit and test_and_clear bit for ARM
Needed for (e.g.) ubifs support to work.
Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Diffstat (limited to 'include/asm-arm/bitops.h')
-rw-r--r-- | include/asm-arm/bitops.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h index 854e225..3c7b00c 100644 --- a/include/asm-arm/bitops.h +++ b/include/asm-arm/bitops.h @@ -17,6 +17,8 @@ #ifdef __KERNEL__ +#include <asm/proc/system.h> + #define smp_mb__before_clear_bit() do { } while (0) #define smp_mb__after_clear_bit() do { } while (0) @@ -37,8 +39,6 @@ static inline void __change_bit(int nr, volatile void *addr) *p ^= mask; } -extern int test_and_set_bit(int nr, volatile void * addr); - static inline int __test_and_set_bit(int nr, volatile void *addr) { unsigned long mask = BIT_MASK(nr); @@ -49,7 +49,17 @@ static inline int __test_and_set_bit(int nr, volatile void *addr) return (old & mask) != 0; } -extern int test_and_clear_bit(int nr, volatile void * addr); +static inline int test_and_set_bit(int nr, volatile void * addr) +{ + unsigned long flags; + int out; + + local_irq_save(flags); + out = __test_and_set_bit(nr, addr); + local_irq_restore(flags); + + return out; +} static inline int __test_and_clear_bit(int nr, volatile void *addr) { @@ -61,6 +71,18 @@ static inline int __test_and_clear_bit(int nr, volatile void *addr) return (old & mask) != 0; } +static inline int test_and_clear_bit(int nr, volatile void * addr) +{ + unsigned long flags; + int out; + + local_irq_save(flags); + out = __test_and_clear_bit(nr, addr); + local_irq_restore(flags); + + return out; +} + extern int test_and_change_bit(int nr, volatile void * addr); static inline int __test_and_change_bit(int nr, volatile void *addr) |