@@ -932,6 +932,34 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
932
932
__ret; \
933
933
})
934
934
935
+ #define __wait_event_state (wq , condition , state ) \
936
+ ___wait_event(wq, condition, state, 0, 0, schedule())
937
+
938
+ /**
939
+ * wait_event_state - sleep until a condition gets true
940
+ * @wq_head: the waitqueue to wait on
941
+ * @condition: a C expression for the event to wait for
942
+ * @state: state to sleep in
943
+ *
944
+ * The process is put to sleep (@state) until the @condition evaluates to true
945
+ * or a signal is received (when allowed by @state). The @condition is checked
946
+ * each time the waitqueue @wq_head is woken up.
947
+ *
948
+ * wake_up() has to be called after changing any variable that could
949
+ * change the result of the wait condition.
950
+ *
951
+ * The function will return -ERESTARTSYS if it was interrupted by a signal
952
+ * (when allowed by @state) and 0 if @condition evaluated to true.
953
+ */
954
+ #define wait_event_state (wq_head , condition , state ) \
955
+ ({ \
956
+ int __ret = 0; \
957
+ might_sleep(); \
958
+ if (!(condition)) \
959
+ __ret = __wait_event_state(wq_head, condition, state); \
960
+ __ret; \
961
+ })
962
+
935
963
#define __wait_event_killable_timeout (wq_head , condition , timeout ) \
936
964
___wait_event(wq_head, ___wait_cond_timeout(condition), \
937
965
TASK_KILLABLE, 0, timeout, \
0 commit comments