diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/completion.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/completion.h b/include/linux/completion.h index 91218036b1c8..4da49916ef3f 100644 --- a/include/linux/completion.h +++ b/include/linux/completion.h | |||
@@ -49,6 +49,13 @@ static inline void complete_release_commit(struct completion *x) | |||
49 | lock_commit_crosslock((struct lockdep_map *)&x->map); | 49 | lock_commit_crosslock((struct lockdep_map *)&x->map); |
50 | } | 50 | } |
51 | 51 | ||
52 | #define init_completion_map(x, m) \ | ||
53 | do { \ | ||
54 | lockdep_init_map_crosslock((struct lockdep_map *)&(x)->map, \ | ||
55 | (m)->name, (m)->key, 0); \ | ||
56 | __init_completion(x); \ | ||
57 | } while (0) | ||
58 | |||
52 | #define init_completion(x) \ | 59 | #define init_completion(x) \ |
53 | do { \ | 60 | do { \ |
54 | static struct lock_class_key __key; \ | 61 | static struct lock_class_key __key; \ |
@@ -58,6 +65,7 @@ do { \ | |||
58 | __init_completion(x); \ | 65 | __init_completion(x); \ |
59 | } while (0) | 66 | } while (0) |
60 | #else | 67 | #else |
68 | #define init_completion_map(x, m) __init_completion(x) | ||
61 | #define init_completion(x) __init_completion(x) | 69 | #define init_completion(x) __init_completion(x) |
62 | static inline void complete_acquire(struct completion *x) {} | 70 | static inline void complete_acquire(struct completion *x) {} |
63 | static inline void complete_release(struct completion *x) {} | 71 | static inline void complete_release(struct completion *x) {} |
@@ -73,6 +81,9 @@ static inline void complete_release_commit(struct completion *x) {} | |||
73 | { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) } | 81 | { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) } |
74 | #endif | 82 | #endif |
75 | 83 | ||
84 | #define COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) \ | ||
85 | (*({ init_completion_map(&(work), &(map)); &(work); })) | ||
86 | |||
76 | #define COMPLETION_INITIALIZER_ONSTACK(work) \ | 87 | #define COMPLETION_INITIALIZER_ONSTACK(work) \ |
77 | (*({ init_completion(&work); &work; })) | 88 | (*({ init_completion(&work); &work; })) |
78 | 89 | ||
@@ -102,8 +113,11 @@ static inline void complete_release_commit(struct completion *x) {} | |||
102 | #ifdef CONFIG_LOCKDEP | 113 | #ifdef CONFIG_LOCKDEP |
103 | # define DECLARE_COMPLETION_ONSTACK(work) \ | 114 | # define DECLARE_COMPLETION_ONSTACK(work) \ |
104 | struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) | 115 | struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) |
116 | # define DECLARE_COMPLETION_ONSTACK_MAP(work, map) \ | ||
117 | struct completion work = COMPLETION_INITIALIZER_ONSTACK_MAP(work, map) | ||
105 | #else | 118 | #else |
106 | # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) | 119 | # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) |
120 | # define DECLARE_COMPLETION_ONSTACK_MAP(work, map) DECLARE_COMPLETION(work) | ||
107 | #endif | 121 | #endif |
108 | 122 | ||
109 | /** | 123 | /** |