Skip to content

Commit

Permalink
wait: explain the shadowing and type inconsistencies
Browse files Browse the repository at this point in the history
Stick in a comment before someone else tries to fix the sparse warning
this generates.

Suggested-by: Andrew Morton <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Peter Zijlstra authored and torvalds committed Apr 18, 2014
1 parent 9cc2368 commit 8b32201
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion include/linux/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit 8b32201

Please sign in to comment.