sync_bitops.h 1.2 KB

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