Lines Matching refs:wf
35 int (*get)(struct intel_wakeref *wf);
36 int (*put)(struct intel_wakeref *wf);
57 void __intel_wakeref_init(struct intel_wakeref *wf,
61 #define intel_wakeref_init(wf, rpm, ops) do { \
64 __intel_wakeref_init((wf), (rpm), (ops), &__key); \
69 int __intel_wakeref_get_first(struct intel_wakeref *wf);
70 void __intel_wakeref_put_last(struct intel_wakeref *wf, unsigned long flags);
74 * @wf: the wakeref
87 intel_wakeref_get(struct intel_wakeref *wf)
90 if (unlikely(!atomic_inc_not_zero(&wf->count)))
91 return __intel_wakeref_get_first(wf);
98 * @wf: the wakeref
106 __intel_wakeref_get(struct intel_wakeref *wf)
108 INTEL_WAKEREF_BUG_ON(atomic_read(&wf->count) <= 0);
109 atomic_inc(&wf->count);
114 * @wf: the wakeref
122 intel_wakeref_get_if_active(struct intel_wakeref *wf)
124 return atomic_inc_not_zero(&wf->count);
129 * @wf: the wakeref
143 __intel_wakeref_put(struct intel_wakeref *wf, unsigned long flags)
146 INTEL_WAKEREF_BUG_ON(atomic_read(&wf->count) <= 0);
147 if (unlikely(!atomic_add_unless(&wf->count, -1, 1)))
148 __intel_wakeref_put_last(wf, flags);
152 intel_wakeref_put(struct intel_wakeref *wf)
155 __intel_wakeref_put(wf, 0);
159 intel_wakeref_put_async(struct intel_wakeref *wf)
161 __intel_wakeref_put(wf, INTEL_WAKEREF_PUT_ASYNC);
166 * @wf: the wakeref
173 intel_wakeref_lock(struct intel_wakeref *wf)
174 __acquires(wf->mutex)
176 mutex_lock(&wf->mutex);
181 * @wf: the wakeref
186 intel_wakeref_unlock(struct intel_wakeref *wf)
187 __releases(wf->mutex)
189 mutex_unlock(&wf->mutex);
194 * @wf: the wakeref
196 * Waits for the active callback (under the @wf->mutex or another CPU) is
200 intel_wakeref_unlock_wait(struct intel_wakeref *wf)
202 mutex_lock(&wf->mutex);
203 mutex_unlock(&wf->mutex);
204 flush_work(&wf->work);
209 * @wf: the wakeref
214 intel_wakeref_is_active(const struct intel_wakeref *wf)
216 return READ_ONCE(wf->wakeref);
221 * @wf: the wakeref
224 __intel_wakeref_defer_park(struct intel_wakeref *wf)
226 lockdep_assert_held(&wf->mutex);
227 INTEL_WAKEREF_BUG_ON(atomic_read(&wf->count));
228 atomic_set_release(&wf->count, 1);
233 * @wf: the wakeref
242 int intel_wakeref_wait_for_idle(struct intel_wakeref *wf);
254 * @wf: the wakeref
267 void intel_wakeref_auto(struct intel_wakeref_auto *wf, unsigned long timeout);
269 void intel_wakeref_auto_init(struct intel_wakeref_auto *wf,
271 void intel_wakeref_auto_fini(struct intel_wakeref_auto *wf);