forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/kernel/sched/swait.c
....@@ -32,6 +32,19 @@
3232 }
3333 EXPORT_SYMBOL(swake_up_locked);
3434
35
+/*
36
+ * Wake up all waiters. This is an interface which is solely exposed for
37
+ * completions and not for general usage.
38
+ *
39
+ * It is intentionally different from swake_up_all() to allow usage from
40
+ * hard interrupt context and interrupt disabled regions.
41
+ */
42
+void swake_up_all_locked(struct swait_queue_head *q)
43
+{
44
+ while (!list_empty(&q->task_list))
45
+ swake_up_locked(q);
46
+}
47
+
3548 void swake_up_one(struct swait_queue_head *q)
3649 {
3750 unsigned long flags;
....@@ -51,6 +64,7 @@
5164 struct swait_queue *curr;
5265 LIST_HEAD(tmp);
5366
67
+ WARN_ON(irqs_disabled());
5468 raw_spin_lock_irq(&q->lock);
5569 list_splice_init(&q->task_list, &tmp);
5670 while (!list_empty(&tmp)) {
....@@ -69,7 +83,7 @@
6983 }
7084 EXPORT_SYMBOL(swake_up_all);
7185
72
-static void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait)
86
+void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait)
7387 {
7488 wait->task = current;
7589 if (list_empty(&wait->task_list))
....@@ -93,7 +107,7 @@
93107 long ret = 0;
94108
95109 raw_spin_lock_irqsave(&q->lock, flags);
96
- if (unlikely(signal_pending_state(state, current))) {
110
+ if (signal_pending_state(state, current)) {
97111 /*
98112 * See prepare_to_wait_event(). TL;DR, subsequent swake_up_one()
99113 * must not see us.