The swait_event_lock_irq() is inspired by wait_event_lock_irq(). This is
required by the workqueue code once it switches to swait.

Signed-off-by: Sebastian Andrzej Siewior <bige...@linutronix.de>
---
 include/linux/swait.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/linux/swait.h b/include/linux/swait.h
index 73e06e9986d4b..12612823c2cb1 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -297,4 +297,18 @@ do {                                                       
                \
        __ret;                                                          \
 })
 
+#define __swait_event_lock_irq(wq, condition, lock, cmd)               \
+       ___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0,          \
+                      raw_spin_unlock_irq(&lock);                      \
+                      cmd;                                             \
+                      schedule();                                      \
+                      raw_spin_lock_irq(&lock))
+
+#define swait_event_lock_irq(wq_head, condition, lock)                 \
+       do {                                                            \
+               if (condition)                                          \
+                       break;                                          \
+               __swait_event_lock_irq(wq_head, condition, lock, );     \
+       } while (0)
+
 #endif /* _LINUX_SWAIT_H */
-- 
2.20.1

Reply via email to