Lines Matching refs:lock
35 QDF_STATUS qdf_mutex_create(qdf_mutex_t *lock, const char *func, int line) in qdf_mutex_create() argument
38 if (!lock) { in qdf_mutex_create()
44 if (LINUX_LOCK_COOKIE == lock->cookie) { in qdf_mutex_create()
57 qdf_lock_stats_create(&lock->stats, func, line); in qdf_mutex_create()
60 mutex_init(&lock->m_lock); in qdf_mutex_create()
61 lock->cookie = LINUX_LOCK_COOKIE; in qdf_mutex_create()
62 lock->state = LOCK_RELEASED; in qdf_mutex_create()
63 lock->process_id = 0; in qdf_mutex_create()
64 lock->refcount = 0; in qdf_mutex_create()
70 QDF_STATUS qdf_mutex_acquire(qdf_mutex_t *lock) in qdf_mutex_acquire() argument
74 if (!lock) { in qdf_mutex_acquire()
81 if (LINUX_LOCK_COOKIE != lock->cookie) { in qdf_mutex_acquire()
95 if ((lock->process_id == current->pid) && in qdf_mutex_acquire()
96 (lock->state == LOCK_ACQUIRED)) { in qdf_mutex_acquire()
97 lock->refcount++; in qdf_mutex_acquire()
99 pe_err("%s: %x %d %d", __func__, lock, current->pid, in qdf_mutex_acquire()
100 lock->refcount); in qdf_mutex_acquire()
105 BEFORE_LOCK(lock, mutex_is_locked(&lock->m_lock)); in qdf_mutex_acquire()
107 mutex_lock(&lock->m_lock); in qdf_mutex_acquire()
108 AFTER_LOCK(lock, __func__); in qdf_mutex_acquire()
109 rc = mutex_is_locked(&lock->m_lock); in qdf_mutex_acquire()
117 pe_err("%s: %x %d", __func__, lock, current->pid); in qdf_mutex_acquire()
119 if (LOCK_DESTROYED != lock->state) { in qdf_mutex_acquire()
120 lock->process_id = current->pid; in qdf_mutex_acquire()
121 lock->refcount++; in qdf_mutex_acquire()
122 lock->state = LOCK_ACQUIRED; in qdf_mutex_acquire()
129 mutex_unlock(&lock->m_lock); in qdf_mutex_acquire()
135 QDF_STATUS qdf_mutex_release(qdf_mutex_t *lock) in qdf_mutex_release() argument
138 if (!lock) { in qdf_mutex_release()
146 if (LINUX_LOCK_COOKIE != lock->cookie) { in qdf_mutex_release()
165 if (lock->process_id != current->pid) { in qdf_mutex_release()
171 __func__, lock->process_id, current->pid); in qdf_mutex_release()
176 if ((lock->process_id == current->pid) && in qdf_mutex_release()
177 (lock->state == LOCK_ACQUIRED)) { in qdf_mutex_release()
178 if (lock->refcount > 0) in qdf_mutex_release()
179 lock->refcount--; in qdf_mutex_release()
182 …QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, "%s: %x %d %d", __func__, lock, lock->process_… in qdf_mutex_release()
183 lock->refcount); in qdf_mutex_release()
185 if (lock->refcount) in qdf_mutex_release()
188 lock->process_id = 0; in qdf_mutex_release()
189 lock->refcount = 0; in qdf_mutex_release()
190 lock->state = LOCK_RELEASED; in qdf_mutex_release()
192 BEFORE_UNLOCK(lock, 0); in qdf_mutex_release()
193 mutex_unlock(&lock->m_lock); in qdf_mutex_release()
195 …QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, "%s: Freeing lock %x %d %d", lock, lock->proce… in qdf_mutex_release()
196 lock->refcount); in qdf_mutex_release()
225 static inline QDF_STATUS qdf_wake_lock_dbg_track(qdf_wake_lock_t *lock, in qdf_wake_lock_dbg_track() argument
229 return qdf_tracker_track(&qdf_wake_lock_tracker, lock, func, line); in qdf_wake_lock_dbg_track()
232 static inline void qdf_wake_lock_dbg_untrack(qdf_wake_lock_t *lock, in qdf_wake_lock_dbg_untrack() argument
235 qdf_tracker_untrack(&qdf_wake_lock_tracker, lock, func, line); in qdf_wake_lock_dbg_untrack()
238 static inline QDF_STATUS qdf_wake_lock_dbg_track(qdf_wake_lock_t *lock, in qdf_wake_lock_dbg_track() argument
245 static inline void qdf_wake_lock_dbg_untrack(qdf_wake_lock_t *lock, in qdf_wake_lock_dbg_untrack() argument
251 const char *qdf_wake_lock_name(qdf_wake_lock_t *lock) in qdf_wake_lock_name() argument
253 if (lock) in qdf_wake_lock_name()
254 return lock->lock.name; in qdf_wake_lock_name()
258 const char *qdf_wake_lock_name(qdf_wake_lock_t *lock) in qdf_wake_lock_name() argument
267 QDF_STATUS __qdf_wake_lock_create(qdf_wake_lock_t *lock, const char *name, in __qdf_wake_lock_create() argument
272 status = qdf_wake_lock_dbg_track(lock, func, line); in __qdf_wake_lock_create()
276 qdf_mem_zero(lock, sizeof(*lock)); in __qdf_wake_lock_create()
277 lock->priv = wakeup_source_register(lock->lock.dev, name); in __qdf_wake_lock_create()
278 if (!(lock->priv)) { in __qdf_wake_lock_create()
283 lock->lock = *(lock->priv); in __qdf_wake_lock_create()
288 QDF_STATUS __qdf_wake_lock_create(qdf_wake_lock_t *lock, const char *name, in __qdf_wake_lock_create() argument
293 status = qdf_wake_lock_dbg_track(lock, func, line); in __qdf_wake_lock_create()
297 wakeup_source_init(&(lock->lock), name); in __qdf_wake_lock_create()
298 lock->priv = &(lock->lock); in __qdf_wake_lock_create()
303 QDF_STATUS __qdf_wake_lock_create(qdf_wake_lock_t *lock, const char *name, in __qdf_wake_lock_create() argument
312 QDF_STATUS qdf_wake_lock_acquire(qdf_wake_lock_t *lock, uint32_t reason) in qdf_wake_lock_acquire() argument
314 host_diag_log_wlock(reason, qdf_wake_lock_name(lock), in qdf_wake_lock_acquire()
317 __pm_stay_awake(lock->priv); in qdf_wake_lock_acquire()
322 QDF_STATUS qdf_wake_lock_acquire(qdf_wake_lock_t *lock, uint32_t reason) in qdf_wake_lock_acquire() argument
330 QDF_STATUS qdf_wake_lock_timeout_acquire(qdf_wake_lock_t *lock, uint32_t msec) in qdf_wake_lock_timeout_acquire() argument
332 pm_wakeup_ws_event(lock->priv, msec, true); in qdf_wake_lock_timeout_acquire()
336 QDF_STATUS qdf_wake_lock_timeout_acquire(qdf_wake_lock_t *lock, uint32_t msec) in qdf_wake_lock_timeout_acquire() argument
341 __pm_wakeup_event(&(lock->lock), msec); in qdf_wake_lock_timeout_acquire()
345 QDF_STATUS qdf_wake_lock_timeout_acquire(qdf_wake_lock_t *lock, uint32_t msec) in qdf_wake_lock_timeout_acquire() argument
353 QDF_STATUS qdf_wake_lock_release(qdf_wake_lock_t *lock, uint32_t reason) in qdf_wake_lock_release() argument
355 host_diag_log_wlock(reason, qdf_wake_lock_name(lock), in qdf_wake_lock_release()
358 __pm_relax(lock->priv); in qdf_wake_lock_release()
363 QDF_STATUS qdf_wake_lock_release(qdf_wake_lock_t *lock, uint32_t reason) in qdf_wake_lock_release() argument
372 void __qdf_wake_lock_destroy(qdf_wake_lock_t *lock, in __qdf_wake_lock_destroy() argument
375 wakeup_source_unregister(lock->priv); in __qdf_wake_lock_destroy()
376 qdf_wake_lock_dbg_untrack(lock, func, line); in __qdf_wake_lock_destroy()
379 void __qdf_wake_lock_destroy(qdf_wake_lock_t *lock, in __qdf_wake_lock_destroy() argument
382 wakeup_source_trash(&(lock->lock)); in __qdf_wake_lock_destroy()
383 qdf_wake_lock_dbg_untrack(lock, func, line); in __qdf_wake_lock_destroy()
386 void __qdf_wake_lock_destroy(qdf_wake_lock_t *lock, in __qdf_wake_lock_destroy() argument
464 QDF_STATUS __qdf_runtime_lock_init(qdf_runtime_lock_t *lock, const char *name) in __qdf_runtime_lock_init() argument
466 return hif_runtime_lock_init(lock, name); in __qdf_runtime_lock_init()
471 void qdf_runtime_lock_deinit(qdf_runtime_lock_t *lock) in qdf_runtime_lock_deinit() argument
473 hif_runtime_lock_deinit(lock->lock); in qdf_runtime_lock_deinit()
493 QDF_STATUS qdf_runtime_pm_prevent_suspend(qdf_runtime_lock_t *lock) in qdf_runtime_pm_prevent_suspend() argument
495 return hif_pm_runtime_prevent_suspend(lock->lock); in qdf_runtime_pm_prevent_suspend()
500 QDF_STATUS qdf_runtime_pm_prevent_suspend_sync(qdf_runtime_lock_t *lock) in qdf_runtime_pm_prevent_suspend_sync() argument
502 return hif_pm_runtime_prevent_suspend_sync(lock->lock); in qdf_runtime_pm_prevent_suspend_sync()
507 QDF_STATUS qdf_runtime_pm_allow_suspend(qdf_runtime_lock_t *lock) in qdf_runtime_pm_allow_suspend() argument
509 return hif_pm_runtime_allow_suspend(lock->lock); in qdf_runtime_pm_allow_suspend()
519 QDF_STATUS qdf_spinlock_acquire(qdf_spinlock_t *lock) in qdf_spinlock_acquire() argument
521 spin_lock(&lock->lock.spinlock); in qdf_spinlock_acquire()
527 QDF_STATUS qdf_spinlock_release(qdf_spinlock_t *lock) in qdf_spinlock_release() argument
529 spin_unlock(&lock->lock.spinlock); in qdf_spinlock_release()
534 QDF_STATUS qdf_mutex_destroy(qdf_mutex_t *lock) in qdf_mutex_destroy() argument
537 if (!lock) { in qdf_mutex_destroy()
543 if (LINUX_LOCK_COOKIE != lock->cookie) { in qdf_mutex_destroy()
557 if (!mutex_trylock(&lock->m_lock)) { in qdf_mutex_destroy()
562 lock->cookie = 0; in qdf_mutex_destroy()
563 lock->state = LOCK_DESTROYED; in qdf_mutex_destroy()
564 lock->process_id = 0; in qdf_mutex_destroy()
565 lock->refcount = 0; in qdf_mutex_destroy()
567 qdf_lock_stats_destroy(&lock->stats); in qdf_mutex_destroy()
568 mutex_unlock(&lock->m_lock); in qdf_mutex_destroy()