diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2009-12-17 21:29:31 -0500 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-29 17:14:11 -0400 |
commit | 59d8d4c53f1e9f6408b87fc22e319e78f664276f (patch) | |
tree | d942e75fe36e9f2dea031e0af2d7119a8548b296 | |
parent | 2079f38466395c64ef40ef3429ee52fd92cdbd99 (diff) |
[ported from 2008.3] Add complete_n() call
-rw-r--r-- | include/linux/completion.h | 1 | ||||
-rw-r--r-- | kernel/sched.c | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/completion.h b/include/linux/completion.h index 4a6b604ef7e4..258bec13d424 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h | |||
@@ -88,6 +88,7 @@ extern bool completion_done(struct completion *x); | |||
88 | 88 | ||
89 | extern void complete(struct completion *); | 89 | extern void complete(struct completion *); |
90 | extern void complete_all(struct completion *); | 90 | extern void complete_all(struct completion *); |
91 | extern void complete_n(struct completion *, int n); | ||
91 | 92 | ||
92 | /** | 93 | /** |
93 | * INIT_COMPLETION: - reinitialize a completion structure | 94 | * INIT_COMPLETION: - reinitialize a completion structure |
diff --git a/kernel/sched.c b/kernel/sched.c index fcaed6b96442..328a67c55287 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -5809,6 +5809,17 @@ void complete_all(struct completion *x) | |||
5809 | } | 5809 | } |
5810 | EXPORT_SYMBOL(complete_all); | 5810 | EXPORT_SYMBOL(complete_all); |
5811 | 5811 | ||
5812 | void complete_n(struct completion *x, int n) | ||
5813 | { | ||
5814 | unsigned long flags; | ||
5815 | |||
5816 | spin_lock_irqsave(&x->wait.lock, flags); | ||
5817 | x->done += n; | ||
5818 | __wake_up_common(&x->wait, TASK_NORMAL, n, 0, NULL); | ||
5819 | spin_unlock_irqrestore(&x->wait.lock, flags); | ||
5820 | } | ||
5821 | EXPORT_SYMBOL(complete_n); | ||
5822 | |||
5812 | static inline long __sched | 5823 | static inline long __sched |
5813 | do_wait_for_common(struct completion *x, long timeout, int state) | 5824 | do_wait_for_common(struct completion *x, long timeout, int state) |
5814 | { | 5825 | { |