Lines Matching +full:wait +full:- +full:state

1 // SPDX-License-Identifier: GPL-2.0
3 * <linux/swait.h> (simple wait queues ) implementation:
9 raw_spin_lock_init(&q->lock); in __init_swait_queue_head()
10 lockdep_set_class_and_name(&q->lock, key, name); in __init_swait_queue_head()
11 INIT_LIST_HEAD(&q->task_list); in __init_swait_queue_head()
25 if (list_empty(&q->task_list)) in swake_up_locked()
28 curr = list_first_entry(&q->task_list, typeof(*curr), task_list); in swake_up_locked()
29 wake_up_process(curr->task); in swake_up_locked()
30 list_del_init(&curr->task_list); in swake_up_locked()
43 while (!list_empty(&q->task_list)) in swake_up_all_locked()
51 raw_spin_lock_irqsave(&q->lock, flags); in swake_up_one()
53 raw_spin_unlock_irqrestore(&q->lock, flags); in swake_up_one()
66 raw_spin_lock_irq(&q->lock); in swake_up_all()
67 list_splice_init(&q->task_list, &tmp); in swake_up_all()
71 wake_up_state(curr->task, TASK_NORMAL); in swake_up_all()
72 list_del_init(&curr->task_list); in swake_up_all()
77 raw_spin_unlock_irq(&q->lock); in swake_up_all()
78 raw_spin_lock_irq(&q->lock); in swake_up_all()
80 raw_spin_unlock_irq(&q->lock); in swake_up_all()
84 void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait) in __prepare_to_swait() argument
86 wait->task = current; in __prepare_to_swait()
87 if (list_empty(&wait->task_list)) in __prepare_to_swait()
88 list_add_tail(&wait->task_list, &q->task_list); in __prepare_to_swait()
91 void prepare_to_swait_exclusive(struct swait_queue_head *q, struct swait_queue *wait, int state) in prepare_to_swait_exclusive() argument
95 raw_spin_lock_irqsave(&q->lock, flags); in prepare_to_swait_exclusive()
96 __prepare_to_swait(q, wait); in prepare_to_swait_exclusive()
97 set_current_state(state); in prepare_to_swait_exclusive()
98 raw_spin_unlock_irqrestore(&q->lock, flags); in prepare_to_swait_exclusive()
102 long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *wait, int state) in prepare_to_swait_event() argument
107 raw_spin_lock_irqsave(&q->lock, flags); in prepare_to_swait_event()
108 if (signal_pending_state(state, current)) { in prepare_to_swait_event()
113 list_del_init(&wait->task_list); in prepare_to_swait_event()
114 ret = -ERESTARTSYS; in prepare_to_swait_event()
116 __prepare_to_swait(q, wait); in prepare_to_swait_event()
117 set_current_state(state); in prepare_to_swait_event()
119 raw_spin_unlock_irqrestore(&q->lock, flags); in prepare_to_swait_event()
125 void __finish_swait(struct swait_queue_head *q, struct swait_queue *wait) in __finish_swait() argument
128 if (!list_empty(&wait->task_list)) in __finish_swait()
129 list_del_init(&wait->task_list); in __finish_swait()
132 void finish_swait(struct swait_queue_head *q, struct swait_queue *wait) in finish_swait() argument
138 if (!list_empty_careful(&wait->task_list)) { in finish_swait()
139 raw_spin_lock_irqsave(&q->lock, flags); in finish_swait()
140 list_del_init(&wait->task_list); in finish_swait()
141 raw_spin_unlock_irqrestore(&q->lock, flags); in finish_swait()