diff options
Diffstat (limited to 'include/linux/wait.h')
-rw-r--r-- | include/linux/wait.h | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index a210ede73b56..cf3c2f5dba51 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -77,7 +77,14 @@ struct task_struct; | |||
77 | #define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ | 77 | #define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ |
78 | { .flags = word, .bit_nr = bit, } | 78 | { .flags = word, .bit_nr = bit, } |
79 | 79 | ||
80 | extern void init_waitqueue_head(wait_queue_head_t *q); | 80 | extern void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *); |
81 | |||
82 | #define init_waitqueue_head(q) \ | ||
83 | do { \ | ||
84 | static struct lock_class_key __key; \ | ||
85 | \ | ||
86 | __init_waitqueue_head((q), &__key); \ | ||
87 | } while (0) | ||
81 | 88 | ||
82 | #ifdef CONFIG_LOCKDEP | 89 | #ifdef CONFIG_LOCKDEP |
83 | # define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ | 90 | # define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \ |
@@ -132,11 +139,12 @@ static inline void __remove_wait_queue(wait_queue_head_t *head, | |||
132 | list_del(&old->task_list); | 139 | list_del(&old->task_list); |
133 | } | 140 | } |
134 | 141 | ||
135 | void __wake_up_common(wait_queue_head_t *q, unsigned int mode, | ||
136 | int nr_exclusive, int sync, void *key); | ||
137 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); | 142 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); |
138 | extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); | 143 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); |
139 | extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); | 144 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, |
145 | void *key); | ||
146 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); | ||
147 | void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); | ||
140 | void __wake_up_bit(wait_queue_head_t *, void *, int); | 148 | void __wake_up_bit(wait_queue_head_t *, void *, int); |
141 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); | 149 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); |
142 | int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); | 150 | int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); |
@@ -155,21 +163,17 @@ wait_queue_head_t *bit_waitqueue(void *, int); | |||
155 | #define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) | 163 | #define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) |
156 | #define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1) | 164 | #define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1) |
157 | 165 | ||
158 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
159 | /* | 166 | /* |
160 | * macro to avoid include hell | 167 | * Wakeup macros to be used to report events to the targets. |
161 | */ | 168 | */ |
162 | #define wake_up_nested(x, s) \ | 169 | #define wake_up_poll(x, m) \ |
163 | do { \ | 170 | __wake_up(x, TASK_NORMAL, 1, (void *) (m)) |
164 | unsigned long flags; \ | 171 | #define wake_up_locked_poll(x, m) \ |
165 | \ | 172 | __wake_up_locked_key((x), TASK_NORMAL, (void *) (m)) |
166 | spin_lock_irqsave_nested(&(x)->lock, flags, (s)); \ | 173 | #define wake_up_interruptible_poll(x, m) \ |
167 | wake_up_locked(x); \ | 174 | __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m)) |
168 | spin_unlock_irqrestore(&(x)->lock, flags); \ | 175 | #define wake_up_interruptible_sync_poll(x, m) \ |
169 | } while (0) | 176 | __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m)) |
170 | #else | ||
171 | #define wake_up_nested(x, s) wake_up(x) | ||
172 | #endif | ||
173 | 177 | ||
174 | #define __wait_event(wq, condition) \ | 178 | #define __wait_event(wq, condition) \ |
175 | do { \ | 179 | do { \ |
@@ -441,13 +445,15 @@ void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, | |||
441 | int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | 445 | int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); |
442 | int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | 446 | int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); |
443 | 447 | ||
444 | #define DEFINE_WAIT(name) \ | 448 | #define DEFINE_WAIT_FUNC(name, function) \ |
445 | wait_queue_t name = { \ | 449 | wait_queue_t name = { \ |
446 | .private = current, \ | 450 | .private = current, \ |
447 | .func = autoremove_wake_function, \ | 451 | .func = function, \ |
448 | .task_list = LIST_HEAD_INIT((name).task_list), \ | 452 | .task_list = LIST_HEAD_INIT((name).task_list), \ |
449 | } | 453 | } |
450 | 454 | ||
455 | #define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, autoremove_wake_function) | ||
456 | |||
451 | #define DEFINE_WAIT_BIT(name, word, bit) \ | 457 | #define DEFINE_WAIT_BIT(name, word, bit) \ |
452 | struct wait_bit_queue name = { \ | 458 | struct wait_bit_queue name = { \ |
453 | .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ | 459 | .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ |