mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
cadefd3d6c
commit
27e4f9d001
1 changed files with 13 additions and 1 deletions
|
@ -191,11 +191,23 @@ wait_queue_head_t *bit_waitqueue(void *, int);
|
||||||
(!__builtin_constant_p(state) || \
|
(!__builtin_constant_p(state) || \
|
||||||
state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
|
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) \
|
#define ___wait_event(wq, condition, state, exclusive, ret, cmd) \
|
||||||
({ \
|
({ \
|
||||||
__label__ __out; \
|
__label__ __out; \
|
||||||
wait_queue_t __wait; \
|
wait_queue_t __wait; \
|
||||||
long __ret = ret; \
|
long __ret = ret; /* explicit shadow */ \
|
||||||
\
|
\
|
||||||
INIT_LIST_HEAD(&__wait.task_list); \
|
INIT_LIST_HEAD(&__wait.task_list); \
|
||||||
if (exclusive) \
|
if (exclusive) \
|
||||||
|
|
Loading…
Add table
Reference in a new issue