summaryrefslogtreecommitdiffstats
path: root/include/linux/wait.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2014-04-09 12:50:34 +0200
committerIngo Molnar <mingo@kernel.org>2014-04-18 12:07:22 +0200
commit27e4f9d0012a9bb7011aade862f08679d2921ab0 (patch)
tree93bc52db6aba1a6c11d4f72f8eab6ded443b5c99 /include/linux/wait.h
parentsched: Make scale_rt_power() deal with backward clocks (diff)
downloadlinux-27e4f9d0012a9bb7011aade862f08679d2921ab0.tar.xz
linux-27e4f9d0012a9bb7011aade862f08679d2921ab0.zip
sched/wait: Explain the shadowing and type inconsistencies
Stick in a comment before someone else tries to fix the sparse warning this generates. Requested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/n/tip-o2ro6f3vkxklni0bc8f7m68s@git.kernel.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to '')
-rw-r--r--include/linux/wait.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 559044c79232..2b563a15a77d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -191,11 +191,23 @@ wait_queue_head_t *bit_waitqueue(void *, int);
(!__builtin_constant_p(state) || \
state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
+/*
+ * The below macro ___wait_event() has an explicit shadow of the __ret
+ * variable when used from the wait_event_*() macros.
+ *
+ * This is so that both can use the ___wait_cond_timeout() construct
+ * to wrap the condition.
+ *
+ * The type inconsistency of the wait_event_*() __ret variable is also
+ * on purpose; we use long where we can return timeout values and int
+ * otherwise.
+ */
+
#define ___wait_event(wq, condition, state, exclusive, ret, cmd) \
({ \
__label__ __out; \
wait_queue_t __wait; \
- long __ret = ret; \
+ long __ret = ret; /* explicit shadow */ \
\
INIT_LIST_HEAD(&__wait.task_list); \
if (exclusive) \