Isaku Yamahata | 1b051c6 | 2008-10-17 11:17:46 +0900 | [diff] [blame] | 1 | #ifndef _ASM_IA64_SYNC_BITOPS_H |
| 2 | #define _ASM_IA64_SYNC_BITOPS_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright (C) 2008 Isaku Yamahata <yamahata at valinux co jp> |
| 6 | * |
| 7 | * Based on synch_bitops.h which Dan Magenhaimer wrote. |
| 8 | * |
| 9 | * bit operations which provide guaranteed strong synchronisation |
| 10 | * when communicating with Xen or other guest OSes running on other CPUs. |
| 11 | */ |
| 12 | |
| 13 | static inline void sync_set_bit(int nr, volatile void *addr) |
| 14 | { |
| 15 | set_bit(nr, addr); |
| 16 | } |
| 17 | |
| 18 | static inline void sync_clear_bit(int nr, volatile void *addr) |
| 19 | { |
| 20 | clear_bit(nr, addr); |
| 21 | } |
| 22 | |
| 23 | static inline void sync_change_bit(int nr, volatile void *addr) |
| 24 | { |
| 25 | change_bit(nr, addr); |
| 26 | } |
| 27 | |
| 28 | static inline int sync_test_and_set_bit(int nr, volatile void *addr) |
| 29 | { |
| 30 | return test_and_set_bit(nr, addr); |
| 31 | } |
| 32 | |
| 33 | static inline int sync_test_and_clear_bit(int nr, volatile void *addr) |
| 34 | { |
| 35 | return test_and_clear_bit(nr, addr); |
| 36 | } |
| 37 | |
| 38 | static inline int sync_test_and_change_bit(int nr, volatile void *addr) |
| 39 | { |
| 40 | return test_and_change_bit(nr, addr); |
| 41 | } |
| 42 | |
| 43 | static inline int sync_test_bit(int nr, const volatile void *addr) |
| 44 | { |
| 45 | return test_bit(nr, addr); |
| 46 | } |
| 47 | |
| 48 | #define sync_cmpxchg(ptr, old, new) \ |
| 49 | ((__typeof__(*(ptr)))cmpxchg_acq((ptr), (old), (new))) |
| 50 | |
| 51 | #endif /* _ASM_IA64_SYNC_BITOPS_H */ |