Lines Matching refs:lock
93 #define BEFORE_LOCK(lock, was_locked) \ argument
102 #define AFTER_LOCK(lock, func) \ argument
103 lock->stats.acquired_by = func; \
105 lock->stats.acquired++; \
106 lock->stats.last_acquired = AFTER_LOCK_time; \
108 lock->stats.contended++; \
109 lock->stats.contention_time += \
112 lock->stats.non_contention_time += \
117 lock->stats.num_large_contentions++; \
120 lock->stats.max_contention_wait) \
121 lock->stats.max_contention_wait = \
125 #define BEFORE_TRYLOCK(lock) \ argument
132 #define AFTER_TRYLOCK(lock, trylock_return, func) \ argument
135 lock->stats.acquired++; \
136 lock->stats.last_acquired = AFTER_LOCK_time; \
137 lock->stats.non_contention_time += \
139 lock->stats.acquired_by = func; \
144 #define BEFORE_UNLOCK(lock, max_hold_time) \ argument
150 if (unlikely(BEFORE_UNLOCK_time < lock->stats.last_acquired)) \
153 held_time = BEFORE_UNLOCK_time - lock->stats.last_acquired; \
155 lock->stats.held_time += held_time; \
157 if (held_time > lock->stats.max_held_time) \
158 lock->stats.max_held_time = held_time; \
161 lock->stats.num_large_holds++; \
169 lock->stats.acquired_by = NULL; \
240 __qdf_spinlock_t lock; member
268 QDF_STATUS qdf_mutex_create(qdf_mutex_t *lock, const char *func, int line);
276 #define qdf_mutex_create(lock) qdf_mutex_create(lock, __func__, __LINE__) argument
291 QDF_STATUS qdf_mutex_acquire(qdf_mutex_t *lock);
307 QDF_STATUS qdf_mutex_release(qdf_mutex_t *lock);
328 QDF_STATUS qdf_mutex_destroy(qdf_mutex_t *lock);
330 static inline void qdf_spinlock_create(qdf_spinlock_t *lock, const char *func, in qdf_spinlock_create() argument
333 __qdf_spinlock_create(&lock->lock); in qdf_spinlock_create()
336 qdf_lock_stats_create(&lock->stats, func, line); in qdf_spinlock_create()
345 #define qdf_spinlock_create(lock) qdf_spinlock_create(lock, __func__, __LINE__) argument
353 static inline void qdf_spinlock_destroy(qdf_spinlock_t *lock) in qdf_spinlock_destroy() argument
355 qdf_lock_stats_destroy(&lock->stats); in qdf_spinlock_destroy()
356 __qdf_spinlock_destroy(&lock->lock); in qdf_spinlock_destroy()
365 static inline int qdf_spin_is_locked(qdf_spinlock_t *lock) in qdf_spin_is_locked() argument
367 return __qdf_spin_is_locked(&lock->lock); in qdf_spin_is_locked()
370 static inline int qdf_spin_trylock_bh(qdf_spinlock_t *lock, const char *func) in qdf_spin_trylock_bh() argument
374 BEFORE_TRYLOCK(lock); in qdf_spin_trylock_bh()
375 trylock_return = __qdf_spin_trylock_bh(&lock->lock); in qdf_spin_trylock_bh()
376 AFTER_TRYLOCK(lock, trylock_return, func); in qdf_spin_trylock_bh()
387 #define qdf_spin_trylock_bh(lock) qdf_spin_trylock_bh(lock, __func__) argument
389 static inline int qdf_spin_trylock(qdf_spinlock_t *lock, const char *func) in qdf_spin_trylock() argument
393 BEFORE_LOCK(lock, qdf_spin_is_locked(lock)); in qdf_spin_trylock()
394 result = __qdf_spin_trylock(&lock->lock); in qdf_spin_trylock()
395 AFTER_LOCK(lock, func); in qdf_spin_trylock()
406 #define qdf_spin_trylock(lock) qdf_spin_trylock(lock, __func__) argument
408 static inline void qdf_spin_lock_bh(qdf_spinlock_t *lock, const char *func) in qdf_spin_lock_bh() argument
410 BEFORE_LOCK(lock, qdf_spin_is_locked(lock)); in qdf_spin_lock_bh()
411 __qdf_spin_lock_bh(&lock->lock); in qdf_spin_lock_bh()
412 AFTER_LOCK(lock, func); in qdf_spin_lock_bh()
421 #define qdf_spin_lock_bh(lock) qdf_spin_lock_bh(lock, __func__) argument
429 static inline void qdf_spin_unlock_bh(qdf_spinlock_t *lock) in qdf_spin_unlock_bh() argument
431 BEFORE_UNLOCK(lock, QDF_MAX_HOLD_TIME_ALOWED_SPINLOCK_BH); in qdf_spin_unlock_bh()
432 __qdf_spin_unlock_bh(&lock->lock); in qdf_spin_unlock_bh()
446 qdf_spinlock_t *lock, in qdf_spinlock_irq_exec() argument
449 return __qdf_spinlock_irq_exec(hdl, &lock->lock, func, arg); in qdf_spinlock_irq_exec()
452 static inline void qdf_spin_lock(qdf_spinlock_t *lock, const char *func) in qdf_spin_lock() argument
454 BEFORE_LOCK(lock, qdf_spin_is_locked(lock)); in qdf_spin_lock()
455 __qdf_spin_lock(&lock->lock); in qdf_spin_lock()
456 AFTER_LOCK(lock, func); in qdf_spin_lock()
465 #define qdf_spin_lock(lock) qdf_spin_lock(lock, __func__) argument
473 static inline void qdf_spin_unlock(qdf_spinlock_t *lock) in qdf_spin_unlock() argument
475 BEFORE_UNLOCK(lock, QDF_MAX_HOLD_TIME_ALOWED_SPINLOCK); in qdf_spin_unlock()
476 __qdf_spin_unlock(&lock->lock); in qdf_spin_unlock()
479 static inline void qdf_spin_lock_irq(qdf_spinlock_t *lock, unsigned long flags, in qdf_spin_lock_irq() argument
482 BEFORE_LOCK(lock, qdf_spin_is_locked(lock)); in qdf_spin_lock_irq()
483 __qdf_spin_lock_irq(&lock->lock.spinlock, flags); in qdf_spin_lock_irq()
484 AFTER_LOCK(lock, func); in qdf_spin_lock_irq()
494 #define qdf_spin_lock_irq(lock, flags) qdf_spin_lock_irq(lock, flags, __func__) argument
496 static inline void qdf_spin_lock_irqsave(qdf_spinlock_t *lock, const char *func) in qdf_spin_lock_irqsave() argument
498 BEFORE_LOCK(lock, qdf_spin_is_locked(lock)); in qdf_spin_lock_irqsave()
499 __qdf_spin_lock_irqsave(&lock->lock); in qdf_spin_lock_irqsave()
500 AFTER_LOCK(lock, func); in qdf_spin_lock_irqsave()
510 #define qdf_spin_lock_irqsave(lock) qdf_spin_lock_irqsave(lock, __func__) argument
519 static inline void qdf_spin_unlock_irqrestore(qdf_spinlock_t *lock) in qdf_spin_unlock_irqrestore() argument
521 BEFORE_UNLOCK(lock, QDF_MAX_HOLD_TIME_ALOWED_SPINLOCK_IRQ); in qdf_spin_unlock_irqrestore()
522 __qdf_spin_unlock_irqrestore(&lock->lock); in qdf_spin_unlock_irqrestore()
532 static inline void qdf_spin_unlock_irq(qdf_spinlock_t *lock, in qdf_spin_unlock_irq() argument
535 BEFORE_UNLOCK(lock, QDF_MAX_HOLD_TIME_ALOWED_SPINLOCK_IRQ); in qdf_spin_unlock_irq()
536 __qdf_spin_unlock_irq(&lock->lock.spinlock, flags); in qdf_spin_unlock_irq()
625 QDF_STATUS __qdf_wake_lock_create(qdf_wake_lock_t *lock, const char *name,
635 #define qdf_wake_lock_create(lock, name) \ argument
636 __qdf_wake_lock_create(lock, name, __func__, __LINE__)
647 QDF_STATUS qdf_wake_lock_acquire(qdf_wake_lock_t *lock, uint32_t reason);
657 const char *qdf_wake_lock_name(qdf_wake_lock_t *lock);
668 QDF_STATUS qdf_wake_lock_timeout_acquire(qdf_wake_lock_t *lock,
680 QDF_STATUS qdf_wake_lock_release(qdf_wake_lock_t *lock, uint32_t reason);
690 void __qdf_wake_lock_destroy(qdf_wake_lock_t *lock,
699 #define qdf_wake_lock_destroy(lock) \ argument
700 __qdf_wake_lock_destroy(lock, __func__, __LINE__)
715 QDF_STATUS qdf_spinlock_acquire(qdf_spinlock_t *lock);
723 QDF_STATUS qdf_spinlock_release(qdf_spinlock_t *lock);
774 #define qdf_runtime_lock_init(lock) __qdf_runtime_lock_init(lock, #lock) argument
805 QDF_STATUS __qdf_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name);
815 void qdf_runtime_lock_deinit(qdf_runtime_lock_t *lock);
844 QDF_STATUS qdf_runtime_pm_prevent_suspend(qdf_runtime_lock_t *lock);
855 QDF_STATUS qdf_runtime_pm_prevent_suspend_sync(qdf_runtime_lock_t *lock);
866 QDF_STATUS qdf_runtime_pm_allow_suspend(qdf_runtime_lock_t *lock);
891 QDF_STATUS __qdf_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name) in __qdf_runtime_lock_init() argument
897 void qdf_runtime_lock_deinit(qdf_runtime_lock_t *lock) in qdf_runtime_lock_deinit() argument
914 QDF_STATUS qdf_runtime_pm_prevent_suspend(qdf_runtime_lock_t *lock) in qdf_runtime_pm_prevent_suspend() argument
920 QDF_STATUS qdf_runtime_pm_prevent_suspend_sync(qdf_runtime_lock_t *lock) in qdf_runtime_pm_prevent_suspend_sync() argument
926 QDF_STATUS qdf_runtime_pm_allow_suspend(qdf_runtime_lock_t *lock) in qdf_runtime_pm_allow_suspend() argument