summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShahar S Matityahu <shahar.s.matityahu@intel.com>2018-09-20 14:28:30 +0300
committerJohannes Berg <johannes.berg@intel.com>2018-09-24 09:20:28 +0200
commitd9d83fd0d928ebffea7af2267745995ef50ec6c2 (patch)
tree41b7026ed359ae1f3e3221bb48e8a584224fdd09
parentea80c5832dedd40acd24514159045c7b0b0d8759 (diff)
backports: add wait_event_killable_timeout backport support
Allow using wait_event_killable_timeout function in kernel older then 4.13 Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--backport/backport-include/linux/wait.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/backport/backport-include/linux/wait.h b/backport/backport-include/linux/wait.h
index c4b1114e..15a674cf 100644
--- a/backport/backport-include/linux/wait.h
+++ b/backport/backport-include/linux/wait.h
@@ -78,6 +78,21 @@ wait_on_bit_timeout(void *word, int bit, unsigned mode, unsigned long timeout)
#if LINUX_VERSION_IS_LESS(4,13,0)
#define wait_queue_entry_t wait_queue_t
+
+#define wait_event_killable_timeout(wq_head, condition, timeout) \
+({ \
+ long __ret = timeout; \
+ might_sleep(); \
+ if (!___wait_cond_timeout(condition)) \
+ __ret = __wait_event_killable_timeout(wq_head, \
+ condition, timeout); \
+ __ret; \
+})
+
+#define __wait_event_killable_timeout(wq_head, condition, timeout) \
+ ___wait_event(wq_head, ___wait_cond_timeout(condition), \
+ TASK_KILLABLE, 0, timeout, \
+ __ret = schedule_timeout(__ret))
#endif
#endif /* __BACKPORT_LINUX_WAIT_H */