mutex.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Mutexes: blocking mutual exclusion locks
  3. *
  4. * started by Ingo Molnar:
  5. *
  6. * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
  7. *
  8. * This file contains mutex debugging related internal prototypes, for the
  9. * !CONFIG_DEBUG_MUTEXES case. Most of them are NOPs:
  10. */
  11. #define spin_lock_mutex(lock, flags) \
  12. do { spin_lock(lock); (void)(flags); } while (0)
  13. #define spin_unlock_mutex(lock, flags) \
  14. do { spin_unlock(lock); (void)(flags); } while (0)
  15. #define mutex_remove_waiter(lock, waiter, ti) \
  16. __list_del((waiter)->list.prev, (waiter)->list.next)
  17. #ifdef CONFIG_MUTEX_SPIN_ON_OWNER
  18. static inline void mutex_set_owner(struct mutex *lock)
  19. {
  20. lock->owner = current;
  21. }
  22. static inline void mutex_clear_owner(struct mutex *lock)
  23. {
  24. lock->owner = NULL;
  25. }
  26. #else
  27. static inline void mutex_set_owner(struct mutex *lock)
  28. {
  29. }
  30. static inline void mutex_clear_owner(struct mutex *lock)
  31. {
  32. }
  33. #endif
  34. #define debug_mutex_wake_waiter(lock, waiter) do { } while (0)
  35. #define debug_mutex_free_waiter(waiter) do { } while (0)
  36. #define debug_mutex_add_waiter(lock, waiter, ti) do { } while (0)
  37. #define debug_mutex_unlock(lock) do { } while (0)
  38. #define debug_mutex_init(lock, name, key) do { } while (0)
  39. static inline void
  40. debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
  41. {
  42. }