aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/completion.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-08-26 10:25:59 +0200
committerIngo Molnar <mingo@elte.hu>2008-08-26 10:25:59 +0200
commit3cf430b0636045dc524759a0852293ba037732a7 (patch)
tree2c4e03f9028dc23ab4e6ca5a3a5a263af397984f /include/linux/completion.h
parentwait_task_inactive: "improve" the returned value for ->nvcsw == 0 (diff)
parentFix oops in acer_wmi driver (acer_wmi_init) (diff)
downloadlinux-dev-3cf430b0636045dc524759a0852293ba037732a7.tar.xz
linux-dev-3cf430b0636045dc524759a0852293ba037732a7.zip
Merge branch 'linus' into sched/devel
Diffstat (limited to 'include/linux/completion.h')
-rw-r--r--include/linux/completion.h46
1 files changed, 2 insertions, 44 deletions
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 57faa60de9bd..02ef8835999c 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -49,6 +49,8 @@ extern unsigned long wait_for_completion_timeout(struct completion *x,
unsigned long timeout);
extern unsigned long wait_for_completion_interruptible_timeout(
struct completion *x, unsigned long timeout);
+extern bool try_wait_for_completion(struct completion *x);
+extern bool completion_done(struct completion *x);
extern void complete(struct completion *);
extern void complete_all(struct completion *);
@@ -56,48 +58,4 @@ extern void complete_all(struct completion *);
#define INIT_COMPLETION(x) ((x).done = 0)
-/**
- * try_wait_for_completion - try to decrement a completion without blocking
- * @x: completion structure
- *
- * Returns: 0 if a decrement cannot be done without blocking
- * 1 if a decrement succeeded.
- *
- * If a completion is being used as a counting completion,
- * attempt to decrement the counter without blocking. This
- * enables us to avoid waiting if the resource the completion
- * is protecting is not available.
- */
-static inline bool try_wait_for_completion(struct completion *x)
-{
- int ret = 1;
-
- spin_lock_irq(&x->wait.lock);
- if (!x->done)
- ret = 0;
- else
- x->done--;
- spin_unlock_irq(&x->wait.lock);
- return ret;
-}
-
-/**
- * completion_done - Test to see if a completion has any waiters
- * @x: completion structure
- *
- * Returns: 0 if there are waiters (wait_for_completion() in progress)
- * 1 if there are no waiters.
- *
- */
-static inline bool completion_done(struct completion *x)
-{
- int ret = 1;
-
- spin_lock_irq(&x->wait.lock);
- if (!x->done)
- ret = 0;
- spin_unlock_irq(&x->wait.lock);
- return ret;
-}
-
#endif