Lines Matching refs:driver
26 void __dsc_lock(struct dsc_driver *driver) in __dsc_lock() argument
28 dsc_assert(driver); in __dsc_lock()
29 qdf_spin_lock_bh(&driver->lock); in __dsc_lock()
32 void __dsc_unlock(struct dsc_driver *driver) in __dsc_unlock() argument
34 dsc_assert(driver); in __dsc_unlock()
35 qdf_spin_unlock_bh(&driver->lock); in __dsc_unlock()
40 struct dsc_driver *driver; in __dsc_driver_create() local
47 driver = qdf_mem_malloc(sizeof(*driver)); in __dsc_driver_create()
48 if (!driver) in __dsc_driver_create()
51 qdf_spinlock_create(&driver->lock); in __dsc_driver_create()
52 qdf_list_create(&driver->psocs, 0); in __dsc_driver_create()
53 __dsc_trans_init(&driver->trans); in __dsc_driver_create()
54 __dsc_ops_init(&driver->ops); in __dsc_driver_create()
56 *out_driver = driver; in __dsc_driver_create()
72 struct dsc_driver *driver; in __dsc_driver_destroy() local
77 driver = *out_driver; in __dsc_driver_destroy()
78 if (!dsc_assert(driver)) in __dsc_driver_destroy()
84 dsc_assert(qdf_list_empty(&driver->psocs)); in __dsc_driver_destroy()
87 while (__dsc_trans_abort(&driver->trans)) in __dsc_driver_destroy()
91 __dsc_ops_deinit(&driver->ops); in __dsc_driver_destroy()
92 __dsc_trans_deinit(&driver->trans); in __dsc_driver_destroy()
93 qdf_list_destroy(&driver->psocs); in __dsc_driver_destroy()
94 qdf_spinlock_destroy(&driver->lock); in __dsc_driver_destroy()
96 qdf_mem_free(driver); in __dsc_driver_destroy()
104 static bool __dsc_driver_trans_active_down_tree(struct dsc_driver *driver) in __dsc_driver_trans_active_down_tree() argument
109 dsc_for_each_driver_psoc(driver, psoc) { in __dsc_driver_trans_active_down_tree()
122 #define __dsc_driver_can_op(driver) __dsc_driver_can_trans(driver) argument
124 static bool __dsc_driver_can_trans(struct dsc_driver *driver) in __dsc_driver_can_trans() argument
126 return !__dsc_trans_active_or_queued(&driver->trans) && in __dsc_driver_can_trans()
127 !__dsc_driver_trans_active_down_tree(driver); in __dsc_driver_can_trans()
130 static bool __dsc_driver_can_trigger(struct dsc_driver *driver) in __dsc_driver_can_trigger() argument
132 return !__dsc_trans_active(&driver->trans) && in __dsc_driver_can_trigger()
133 !__dsc_driver_trans_active_down_tree(driver); in __dsc_driver_can_trigger()
137 __dsc_driver_trans_start_nolock(struct dsc_driver *driver, const char *desc) in __dsc_driver_trans_start_nolock() argument
139 if (!__dsc_driver_can_trans(driver)) in __dsc_driver_trans_start_nolock()
142 return __dsc_trans_start(&driver->trans, desc); in __dsc_driver_trans_start_nolock()
146 __dsc_driver_trans_start(struct dsc_driver *driver, const char *desc) in __dsc_driver_trans_start() argument
150 if (!dsc_assert(driver)) in __dsc_driver_trans_start()
156 __dsc_lock(driver); in __dsc_driver_trans_start()
157 status = __dsc_driver_trans_start_nolock(driver, desc); in __dsc_driver_trans_start()
158 __dsc_unlock(driver); in __dsc_driver_trans_start()
163 QDF_STATUS dsc_driver_trans_start(struct dsc_driver *driver, const char *desc) in dsc_driver_trans_start() argument
168 status = __dsc_driver_trans_start(driver, desc); in dsc_driver_trans_start()
176 __dsc_driver_trans_start_wait(struct dsc_driver *driver, const char *desc) in __dsc_driver_trans_start_wait() argument
181 if (!dsc_assert(driver)) in __dsc_driver_trans_start_wait()
187 __dsc_lock(driver); in __dsc_driver_trans_start_wait()
190 status = __dsc_driver_trans_start_nolock(driver, desc); in __dsc_driver_trans_start_wait()
194 status = __dsc_trans_queue(&driver->trans, &tran, desc); in __dsc_driver_trans_start_wait()
198 __dsc_unlock(driver); in __dsc_driver_trans_start_wait()
203 __dsc_unlock(driver); in __dsc_driver_trans_start_wait()
209 dsc_driver_trans_start_wait(struct dsc_driver *driver, const char *desc) in dsc_driver_trans_start_wait() argument
214 status = __dsc_driver_trans_start_wait(driver, desc); in dsc_driver_trans_start_wait()
221 bool __dsc_driver_trans_trigger_checked(struct dsc_driver *driver) in __dsc_driver_trans_trigger_checked() argument
223 if (!__dsc_trans_queued(&driver->trans)) in __dsc_driver_trans_trigger_checked()
227 if (!__dsc_driver_can_trigger(driver)) in __dsc_driver_trans_trigger_checked()
230 return __dsc_trans_trigger(&driver->trans); in __dsc_driver_trans_trigger_checked()
233 static void __dsc_driver_trigger_trans(struct dsc_driver *driver) in __dsc_driver_trigger_trans() argument
238 if (__dsc_trans_trigger(&driver->trans)) in __dsc_driver_trigger_trans()
241 dsc_for_each_driver_psoc(driver, psoc) { in __dsc_driver_trigger_trans()
250 static void __dsc_driver_trans_stop(struct dsc_driver *driver) in __dsc_driver_trans_stop() argument
252 if (!dsc_assert(driver)) in __dsc_driver_trans_stop()
255 __dsc_lock(driver); in __dsc_driver_trans_stop()
257 __dsc_trans_stop(&driver->trans); in __dsc_driver_trans_stop()
258 __dsc_driver_trigger_trans(driver); in __dsc_driver_trans_stop()
260 __dsc_unlock(driver); in __dsc_driver_trans_stop()
263 void dsc_driver_trans_stop(struct dsc_driver *driver) in dsc_driver_trans_stop() argument
265 __dsc_driver_trans_stop(driver); in dsc_driver_trans_stop()
268 static void __dsc_driver_assert_trans_protected(struct dsc_driver *driver) in __dsc_driver_assert_trans_protected() argument
270 if (!dsc_assert(driver)) in __dsc_driver_assert_trans_protected()
273 __dsc_lock(driver); in __dsc_driver_assert_trans_protected()
274 dsc_assert(__dsc_trans_active(&driver->trans)); in __dsc_driver_assert_trans_protected()
275 __dsc_unlock(driver); in __dsc_driver_assert_trans_protected()
278 void dsc_driver_assert_trans_protected(struct dsc_driver *driver) in dsc_driver_assert_trans_protected() argument
280 __dsc_driver_assert_trans_protected(driver); in dsc_driver_assert_trans_protected()
284 __dsc_driver_op_start(struct dsc_driver *driver, const char *func) in __dsc_driver_op_start() argument
288 if (!dsc_assert(driver)) in __dsc_driver_op_start()
294 __dsc_lock(driver); in __dsc_driver_op_start()
296 if (!__dsc_driver_can_op(driver)) { in __dsc_driver_op_start()
301 status = __dsc_ops_insert(&driver->ops, func); in __dsc_driver_op_start()
304 __dsc_unlock(driver); in __dsc_driver_op_start()
309 QDF_STATUS _dsc_driver_op_start(struct dsc_driver *driver, const char *func) in _dsc_driver_op_start() argument
314 status = __dsc_driver_op_start(driver, func); in _dsc_driver_op_start()
321 static void __dsc_driver_op_stop(struct dsc_driver *driver, const char *func) in __dsc_driver_op_stop() argument
323 if (!dsc_assert(driver)) in __dsc_driver_op_stop()
329 __dsc_lock(driver); in __dsc_driver_op_stop()
330 if (__dsc_ops_remove(&driver->ops, func)) in __dsc_driver_op_stop()
331 qdf_event_set(&driver->ops.event); in __dsc_driver_op_stop()
332 __dsc_unlock(driver); in __dsc_driver_op_stop()
335 void _dsc_driver_op_stop(struct dsc_driver *driver, const char *func) in _dsc_driver_op_stop() argument
337 __dsc_driver_op_stop(driver, func); in _dsc_driver_op_stop()
340 static void __dsc_driver_wait_for_ops(struct dsc_driver *driver) in __dsc_driver_wait_for_ops() argument
345 if (!dsc_assert(driver)) in __dsc_driver_wait_for_ops()
348 __dsc_lock(driver); in __dsc_driver_wait_for_ops()
351 dsc_assert(!__dsc_driver_can_op(driver)); in __dsc_driver_wait_for_ops()
353 wait = driver->ops.count > 0; in __dsc_driver_wait_for_ops()
355 qdf_event_reset(&driver->ops.event); in __dsc_driver_wait_for_ops()
357 __dsc_unlock(driver); in __dsc_driver_wait_for_ops()
360 qdf_wait_single_event(&driver->ops.event, 0); in __dsc_driver_wait_for_ops()
363 dsc_for_each_driver_psoc(driver, psoc) in __dsc_driver_wait_for_ops()
367 void dsc_driver_wait_for_ops(struct dsc_driver *driver) in dsc_driver_wait_for_ops() argument
369 __dsc_driver_wait_for_ops(driver); in dsc_driver_wait_for_ops()