Lines Matching refs:psd
52 static void pm_clk_list_lock(struct pm_subsys_data *psd) in pm_clk_list_lock() argument
53 __acquires(&psd->lock) in pm_clk_list_lock()
55 mutex_lock(&psd->clock_mutex); in pm_clk_list_lock()
56 spin_lock_irq(&psd->lock); in pm_clk_list_lock()
64 static void pm_clk_list_unlock(struct pm_subsys_data *psd) in pm_clk_list_unlock() argument
65 __releases(&psd->lock) in pm_clk_list_unlock()
67 spin_unlock_irq(&psd->lock); in pm_clk_list_unlock()
68 mutex_unlock(&psd->clock_mutex); in pm_clk_list_unlock()
86 static int pm_clk_op_lock(struct pm_subsys_data *psd, unsigned long *flags, in pm_clk_op_lock() argument
93 spin_lock_irqsave(&psd->lock, *flags); in pm_clk_op_lock()
94 if (!psd->clock_op_might_sleep) { in pm_clk_op_lock()
96 __release(&psd->lock); in pm_clk_op_lock()
103 fn, psd->clock_op_might_sleep); in pm_clk_op_lock()
104 spin_unlock_irqrestore(&psd->lock, *flags); in pm_clk_op_lock()
110 spin_unlock_irqrestore(&psd->lock, *flags); in pm_clk_op_lock()
111 mutex_lock(&psd->clock_mutex); in pm_clk_op_lock()
117 if (likely(psd->clock_op_might_sleep)) in pm_clk_op_lock()
120 mutex_unlock(&psd->clock_mutex); in pm_clk_op_lock()
130 static void pm_clk_op_unlock(struct pm_subsys_data *psd, unsigned long *flags) in pm_clk_op_unlock() argument
133 if (psd->clock_op_might_sleep) { in pm_clk_op_unlock()
134 mutex_unlock(&psd->clock_mutex); in pm_clk_op_unlock()
137 __acquire(&psd->lock); in pm_clk_op_unlock()
138 spin_unlock_irqrestore(&psd->lock, *flags); in pm_clk_op_unlock()
198 struct pm_subsys_data *psd = dev_to_psd(dev); in __pm_clk_add() local
201 if (!psd) in __pm_clk_add()
224 pm_clk_list_lock(psd); in __pm_clk_add()
225 list_add_tail(&ce->node, &psd->clock_list); in __pm_clk_add()
227 psd->clock_op_might_sleep++; in __pm_clk_add()
228 pm_clk_list_unlock(psd); in __pm_clk_add()
389 struct pm_subsys_data *psd = dev_to_psd(dev); in pm_clk_remove() local
392 if (!psd) in pm_clk_remove()
395 pm_clk_list_lock(psd); in pm_clk_remove()
397 list_for_each_entry(ce, &psd->clock_list, node) { in pm_clk_remove()
406 pm_clk_list_unlock(psd); in pm_clk_remove()
412 psd->clock_op_might_sleep--; in pm_clk_remove()
413 pm_clk_list_unlock(psd); in pm_clk_remove()
429 struct pm_subsys_data *psd = dev_to_psd(dev); in pm_clk_remove_clk() local
432 if (!psd || !clk) in pm_clk_remove_clk()
435 pm_clk_list_lock(psd); in pm_clk_remove_clk()
437 list_for_each_entry(ce, &psd->clock_list, node) { in pm_clk_remove_clk()
442 pm_clk_list_unlock(psd); in pm_clk_remove_clk()
448 psd->clock_op_might_sleep--; in pm_clk_remove_clk()
449 pm_clk_list_unlock(psd); in pm_clk_remove_clk()
464 struct pm_subsys_data *psd = dev_to_psd(dev); in pm_clk_init() local
465 if (psd) { in pm_clk_init()
466 INIT_LIST_HEAD(&psd->clock_list); in pm_clk_init()
467 mutex_init(&psd->clock_mutex); in pm_clk_init()
468 psd->clock_op_might_sleep = 0; in pm_clk_init()
496 struct pm_subsys_data *psd = dev_to_psd(dev); in pm_clk_destroy() local
500 if (!psd) in pm_clk_destroy()
505 pm_clk_list_lock(psd); in pm_clk_destroy()
507 list_for_each_entry_safe_reverse(ce, c, &psd->clock_list, node) in pm_clk_destroy()
509 psd->clock_op_might_sleep = 0; in pm_clk_destroy()
511 pm_clk_list_unlock(psd); in pm_clk_destroy()
545 struct pm_subsys_data *psd = dev_to_psd(dev); in pm_clk_suspend() local
552 if (!psd) in pm_clk_suspend()
555 ret = pm_clk_op_lock(psd, &flags, __func__); in pm_clk_suspend()
559 list_for_each_entry_reverse(ce, &psd->clock_list, node) { in pm_clk_suspend()
571 pm_clk_op_unlock(psd, &flags); in pm_clk_suspend()
583 struct pm_subsys_data *psd = dev_to_psd(dev); in pm_clk_resume() local
590 if (!psd) in pm_clk_resume()
593 ret = pm_clk_op_lock(psd, &flags, __func__); in pm_clk_resume()
597 list_for_each_entry(ce, &psd->clock_list, node) in pm_clk_resume()
600 pm_clk_op_unlock(psd, &flags); in pm_clk_resume()