diff options
Diffstat (limited to 'include/linux/wait.h')
| -rw-r--r-- | include/linux/wait.h | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index ef609f842fac..5d631c17eaee 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
| @@ -132,9 +132,14 @@ static inline void __remove_wait_queue(wait_queue_head_t *head, | |||
| 132 | list_del(&old->task_list); | 132 | list_del(&old->task_list); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | void __wake_up_common(wait_queue_head_t *q, unsigned int mode, | ||
| 136 | int nr_exclusive, int sync, void *key); | ||
| 135 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); | 137 | void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); |
| 136 | extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); | 138 | void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); |
| 137 | extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); | 139 | void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, |
| 140 | void *key); | ||
| 141 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode); | ||
| 142 | void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); | ||
| 138 | void __wake_up_bit(wait_queue_head_t *, void *, int); | 143 | void __wake_up_bit(wait_queue_head_t *, void *, int); |
| 139 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); | 144 | int __wait_on_bit(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); |
| 140 | int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); | 145 | int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned); |
| @@ -153,21 +158,17 @@ wait_queue_head_t *bit_waitqueue(void *, int); | |||
| 153 | #define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) | 158 | #define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) |
| 154 | #define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1) | 159 | #define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1) |
| 155 | 160 | ||
| 156 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 157 | /* | 161 | /* |
| 158 | * macro to avoid include hell | 162 | * Wakeup macros to be used to report events to the targets. |
| 159 | */ | 163 | */ |
| 160 | #define wake_up_nested(x, s) \ | 164 | #define wake_up_poll(x, m) \ |
| 161 | do { \ | 165 | __wake_up(x, TASK_NORMAL, 1, (void *) (m)) |
| 162 | unsigned long flags; \ | 166 | #define wake_up_locked_poll(x, m) \ |
| 163 | \ | 167 | __wake_up_locked_key((x), TASK_NORMAL, (void *) (m)) |
| 164 | spin_lock_irqsave_nested(&(x)->lock, flags, (s)); \ | 168 | #define wake_up_interruptible_poll(x, m) \ |
| 165 | wake_up_locked(x); \ | 169 | __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m)) |
| 166 | spin_unlock_irqrestore(&(x)->lock, flags); \ | 170 | #define wake_up_interruptible_sync_poll(x, m) \ |
| 167 | } while (0) | 171 | __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m)) |
| 168 | #else | ||
| 169 | #define wake_up_nested(x, s) wake_up(x) | ||
| 170 | #endif | ||
| 171 | 172 | ||
| 172 | #define __wait_event(wq, condition) \ | 173 | #define __wait_event(wq, condition) \ |
| 173 | do { \ | 174 | do { \ |
| @@ -333,16 +334,19 @@ do { \ | |||
| 333 | for (;;) { \ | 334 | for (;;) { \ |
| 334 | prepare_to_wait_exclusive(&wq, &__wait, \ | 335 | prepare_to_wait_exclusive(&wq, &__wait, \ |
| 335 | TASK_INTERRUPTIBLE); \ | 336 | TASK_INTERRUPTIBLE); \ |
| 336 | if (condition) \ | 337 | if (condition) { \ |
| 338 | finish_wait(&wq, &__wait); \ | ||
| 337 | break; \ | 339 | break; \ |
| 340 | } \ | ||
| 338 | if (!signal_pending(current)) { \ | 341 | if (!signal_pending(current)) { \ |
| 339 | schedule(); \ | 342 | schedule(); \ |
| 340 | continue; \ | 343 | continue; \ |
| 341 | } \ | 344 | } \ |
| 342 | ret = -ERESTARTSYS; \ | 345 | ret = -ERESTARTSYS; \ |
| 346 | abort_exclusive_wait(&wq, &__wait, \ | ||
| 347 | TASK_INTERRUPTIBLE, NULL); \ | ||
| 343 | break; \ | 348 | break; \ |
| 344 | } \ | 349 | } \ |
| 345 | finish_wait(&wq, &__wait); \ | ||
| 346 | } while (0) | 350 | } while (0) |
| 347 | 351 | ||
| 348 | #define wait_event_interruptible_exclusive(wq, condition) \ | 352 | #define wait_event_interruptible_exclusive(wq, condition) \ |
| @@ -431,6 +435,8 @@ extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, | |||
| 431 | void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state); | 435 | void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state); |
| 432 | void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state); | 436 | void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state); |
| 433 | void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); | 437 | void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); |
| 438 | void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, | ||
| 439 | unsigned int mode, void *key); | ||
| 434 | int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | 440 | int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); |
| 435 | int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); | 441 | int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); |
| 436 | 442 | ||
