diff options
author | Peter Zijlstra <peterz@infradead.org> | 2014-04-18 18:07:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-18 19:40:08 -0400 |
commit | 8b32201de1f87878ace971bfdc2846a4f3a5bb2b (patch) | |
tree | 7f9bf1d69e618d47591786b1e39262251eba5119 /include/linux/wait.h | |
parent | 9cc236827fde5e254fd995a0023c05c5ee3a3ba6 (diff) |
wait: explain the shadowing and type inconsistencies
Stick in a comment before someone else tries to fix the sparse warning
this generates.
Suggested-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
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/wait.h')
-rw-r--r-- | include/linux/wait.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index e7d9d9ed14f5..bd68819f0815 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -191,11 +191,23 @@ wait_queue_head_t *bit_waitqueue(void *, int); | |||
191 | (!__builtin_constant_p(state) || \ | 191 | (!__builtin_constant_p(state) || \ |
192 | state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \ | 192 | state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \ |
193 | 193 | ||
194 | /* | ||
195 | * The below macro ___wait_event() has an explicit shadow of the __ret | ||
196 | * variable when used from the wait_event_*() macros. | ||
197 | * | ||
198 | * This is so that both can use the ___wait_cond_timeout() construct | ||
199 | * to wrap the condition. | ||
200 | * | ||
201 | * The type inconsistency of the wait_event_*() __ret variable is also | ||
202 | * on purpose; we use long where we can return timeout values and int | ||
203 | * otherwise. | ||
204 | */ | ||
205 | |||
194 | #define ___wait_event(wq, condition, state, exclusive, ret, cmd) \ | 206 | #define ___wait_event(wq, condition, state, exclusive, ret, cmd) \ |
195 | ({ \ | 207 | ({ \ |
196 | __label__ __out; \ | 208 | __label__ __out; \ |
197 | wait_queue_t __wait; \ | 209 | wait_queue_t __wait; \ |
198 | long __ret = ret; \ | 210 | long __ret = ret; /* explicit shadow */ \ |
199 | \ | 211 | \ |
200 | INIT_LIST_HEAD(&__wait.task_list); \ | 212 | INIT_LIST_HEAD(&__wait.task_list); \ |
201 | if (exclusive) \ | 213 | if (exclusive) \ |