diff options
Diffstat (limited to 'include/linux/completion.h')
-rw-r--r-- | include/linux/completion.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/completion.h b/include/linux/completion.h index 90663ad217f..268c5a4a2bd 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h | |||
@@ -18,9 +18,24 @@ struct completion { | |||
18 | #define COMPLETION_INITIALIZER(work) \ | 18 | #define COMPLETION_INITIALIZER(work) \ |
19 | { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) } | 19 | { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) } |
20 | 20 | ||
21 | #define COMPLETION_INITIALIZER_ONSTACK(work) \ | ||
22 | ({ init_completion(&work); work; }) | ||
23 | |||
21 | #define DECLARE_COMPLETION(work) \ | 24 | #define DECLARE_COMPLETION(work) \ |
22 | struct completion work = COMPLETION_INITIALIZER(work) | 25 | struct completion work = COMPLETION_INITIALIZER(work) |
23 | 26 | ||
27 | /* | ||
28 | * Lockdep needs to run a non-constant initializer for on-stack | ||
29 | * completions - so we use the _ONSTACK() variant for those that | ||
30 | * are on the kernel stack: | ||
31 | */ | ||
32 | #ifdef CONFIG_LOCKDEP | ||
33 | # define DECLARE_COMPLETION_ONSTACK(work) \ | ||
34 | struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) | ||
35 | #else | ||
36 | # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) | ||
37 | #endif | ||
38 | |||
24 | static inline void init_completion(struct completion *x) | 39 | static inline void init_completion(struct completion *x) |
25 | { | 40 | { |
26 | x->done = 0; | 41 | x->done = 0; |