sched/wait: Collapse __wait_event_interruptible_lock_irq_timeout()
authorPeter Zijlstra <peterz@infradead.org>
Wed, 2 Oct 2013 09:22:29 +0000 (11:22 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 4 Oct 2013 08:16:20 +0000 (10:16 +0200)
Reduce macro complexity by using the new ___wait_event() helper.
No change in behaviour, identical generated code.

Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20131002092528.759956109@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/wait.h

index a577a85..5d5408b 100644 (file)
@@ -763,25 +763,12 @@ do {                                                                      \
        __ret;                                                          \
 })
 
-#define __wait_event_interruptible_lock_irq_timeout(wq, condition,     \
-                                                   lock, ret)          \
-do {                                                                   \
-       DEFINE_WAIT(__wait);                                            \
-                                                                       \
-       for (;;) {                                                      \
-               prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE);      \
-               if (___wait_cond_timeout(condition, ret))               \
-                       break;                                          \
-               if (signal_pending(current)) {                          \
-                       ret = -ERESTARTSYS;                             \
-                       break;                                          \
-               }                                                       \
-               spin_unlock_irq(&lock);                                 \
-               ret = schedule_timeout(ret);                            \
-               spin_lock_irq(&lock);                                   \
-       }                                                               \
-       finish_wait(&wq, &__wait);                                      \
-} while (0)
+#define __wait_event_interruptible_lock_irq_timeout(wq, condition, lock, ret) \
+       ___wait_event(wq, ___wait_cond_timeout(condition, ret),               \
+                     TASK_INTERRUPTIBLE, 0, ret,                             \
+                     spin_unlock_irq(&lock);                                 \
+                     ret = schedule_timeout(ret);                            \
+                     spin_lock_irq(&lock));
 
 /**
  * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses.