aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-01-04 20:50:16 -0500
committerIngo Molnar <mingo@elte.hu>2011-01-05 08:15:50 -0500
commit6bf4123760a5aece6e4829ce90b70b6ffd751d65 (patch)
treef7c34fba897b0a1270817c415b8c095958f59add /kernel/sched.c
parent27066fd484a32c80630136aa2b91c980f3198f9d (diff)
sched: Change wait_for_completion_*_timeout() to return a signed long
wait_for_completion_*_timeout() can return: 0: if the wait timed out -ve: if the wait was interrupted +ve: if the completion was completed. As they currently return an 'unsigned long', the last two cases are not easily distinguished which can easily result in buggy code, as is the case for the recently added wait_for_completion_interruptible_timeout() call in net/sunrpc/cache.c So change them both to return 'long'. As MAX_SCHEDULE_TIMEOUT is LONG_MAX, a large +ve return value should never overflow. Signed-off-by: NeilBrown <neilb@suse.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: J. Bruce Fields <bfields@fieldses.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> LKML-Reference: <20110105125016.64ccab0e@notabene.brown> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index f2f914e0c47c..114a0deb2b01 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4395,7 +4395,7 @@ EXPORT_SYMBOL(wait_for_completion_interruptible);
4395 * This waits for either a completion of a specific task to be signaled or for a 4395 * This waits for either a completion of a specific task to be signaled or for a
4396 * specified timeout to expire. It is interruptible. The timeout is in jiffies. 4396 * specified timeout to expire. It is interruptible. The timeout is in jiffies.
4397 */ 4397 */
4398unsigned long __sched 4398long __sched
4399wait_for_completion_interruptible_timeout(struct completion *x, 4399wait_for_completion_interruptible_timeout(struct completion *x,
4400 unsigned long timeout) 4400 unsigned long timeout)
4401{ 4401{
@@ -4428,7 +4428,7 @@ EXPORT_SYMBOL(wait_for_completion_killable);
4428 * signaled or for a specified timeout to expire. It can be 4428 * signaled or for a specified timeout to expire. It can be
4429 * interrupted by a kill signal. The timeout is in jiffies. 4429 * interrupted by a kill signal. The timeout is in jiffies.
4430 */ 4430 */
4431unsigned long __sched 4431long __sched
4432wait_for_completion_killable_timeout(struct completion *x, 4432wait_for_completion_killable_timeout(struct completion *x,
4433 unsigned long timeout) 4433 unsigned long timeout)
4434{ 4434{