From: David Howells Date: Fri, 3 May 2019 17:30:33 +0000 (+0100) Subject: Add wait_var_event_interruptible() X-Git-Tag: v5.2-rc1~28^2~12 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=a49294eac27c7159cd8b89a96c3b1a857e37b683;p=linux.git Add wait_var_event_interruptible() Add wait_var_event_interruptible() to allow interruptible waits for events. Signed-off-by: David Howells Acked-by: Peter Zijlstra (Intel) --- diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h index 2b0072fa5e92..7dec36aecbd9 100644 --- a/include/linux/wait_bit.h +++ b/include/linux/wait_bit.h @@ -305,6 +305,19 @@ do { \ __ret; \ }) +#define __wait_var_event_interruptible(var, condition) \ + ___wait_var_event(var, condition, TASK_INTERRUPTIBLE, 0, 0, \ + schedule()) + +#define wait_var_event_interruptible(var, condition) \ +({ \ + int __ret = 0; \ + might_sleep(); \ + if (!(condition)) \ + __ret = __wait_var_event_interruptible(var, condition); \ + __ret; \ +}) + /** * clear_and_wake_up_bit - clear a bit and wake up anyone waiting on that bit *