diff options
Diffstat (limited to 'kernel/sched/wait.c')
-rw-r--r-- | kernel/sched/wait.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index 0ffa20ae657b..15cab1a4f84e 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c | |||
@@ -319,14 +319,14 @@ EXPORT_SYMBOL(wake_bit_function); | |||
319 | */ | 319 | */ |
320 | int __sched | 320 | int __sched |
321 | __wait_on_bit(wait_queue_head_t *wq, struct wait_bit_queue *q, | 321 | __wait_on_bit(wait_queue_head_t *wq, struct wait_bit_queue *q, |
322 | int (*action)(void *), unsigned mode) | 322 | wait_bit_action_f *action, unsigned mode) |
323 | { | 323 | { |
324 | int ret = 0; | 324 | int ret = 0; |
325 | 325 | ||
326 | do { | 326 | do { |
327 | prepare_to_wait(wq, &q->wait, mode); | 327 | prepare_to_wait(wq, &q->wait, mode); |
328 | if (test_bit(q->key.bit_nr, q->key.flags)) | 328 | if (test_bit(q->key.bit_nr, q->key.flags)) |
329 | ret = (*action)(q->key.flags); | 329 | ret = (*action)(&q->key); |
330 | } while (test_bit(q->key.bit_nr, q->key.flags) && !ret); | 330 | } while (test_bit(q->key.bit_nr, q->key.flags) && !ret); |
331 | finish_wait(wq, &q->wait); | 331 | finish_wait(wq, &q->wait); |
332 | return ret; | 332 | return ret; |
@@ -334,7 +334,7 @@ __wait_on_bit(wait_queue_head_t *wq, struct wait_bit_queue *q, | |||
334 | EXPORT_SYMBOL(__wait_on_bit); | 334 | EXPORT_SYMBOL(__wait_on_bit); |
335 | 335 | ||
336 | int __sched out_of_line_wait_on_bit(void *word, int bit, | 336 | int __sched out_of_line_wait_on_bit(void *word, int bit, |
337 | int (*action)(void *), unsigned mode) | 337 | wait_bit_action_f *action, unsigned mode) |
338 | { | 338 | { |
339 | wait_queue_head_t *wq = bit_waitqueue(word, bit); | 339 | wait_queue_head_t *wq = bit_waitqueue(word, bit); |
340 | DEFINE_WAIT_BIT(wait, word, bit); | 340 | DEFINE_WAIT_BIT(wait, word, bit); |
@@ -345,7 +345,7 @@ EXPORT_SYMBOL(out_of_line_wait_on_bit); | |||
345 | 345 | ||
346 | int __sched | 346 | int __sched |
347 | __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, | 347 | __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, |
348 | int (*action)(void *), unsigned mode) | 348 | wait_bit_action_f *action, unsigned mode) |
349 | { | 349 | { |
350 | do { | 350 | do { |
351 | int ret; | 351 | int ret; |
@@ -353,7 +353,7 @@ __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, | |||
353 | prepare_to_wait_exclusive(wq, &q->wait, mode); | 353 | prepare_to_wait_exclusive(wq, &q->wait, mode); |
354 | if (!test_bit(q->key.bit_nr, q->key.flags)) | 354 | if (!test_bit(q->key.bit_nr, q->key.flags)) |
355 | continue; | 355 | continue; |
356 | ret = action(q->key.flags); | 356 | ret = action(&q->key); |
357 | if (!ret) | 357 | if (!ret) |
358 | continue; | 358 | continue; |
359 | abort_exclusive_wait(wq, &q->wait, mode, &q->key); | 359 | abort_exclusive_wait(wq, &q->wait, mode, &q->key); |
@@ -365,7 +365,7 @@ __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, | |||
365 | EXPORT_SYMBOL(__wait_on_bit_lock); | 365 | EXPORT_SYMBOL(__wait_on_bit_lock); |
366 | 366 | ||
367 | int __sched out_of_line_wait_on_bit_lock(void *word, int bit, | 367 | int __sched out_of_line_wait_on_bit_lock(void *word, int bit, |
368 | int (*action)(void *), unsigned mode) | 368 | wait_bit_action_f *action, unsigned mode) |
369 | { | 369 | { |
370 | wait_queue_head_t *wq = bit_waitqueue(word, bit); | 370 | wait_queue_head_t *wq = bit_waitqueue(word, bit); |
371 | DEFINE_WAIT_BIT(wait, word, bit); | 371 | DEFINE_WAIT_BIT(wait, word, bit); |
@@ -502,3 +502,21 @@ void wake_up_atomic_t(atomic_t *p) | |||
502 | __wake_up_bit(atomic_t_waitqueue(p), p, WAIT_ATOMIC_T_BIT_NR); | 502 | __wake_up_bit(atomic_t_waitqueue(p), p, WAIT_ATOMIC_T_BIT_NR); |
503 | } | 503 | } |
504 | EXPORT_SYMBOL(wake_up_atomic_t); | 504 | EXPORT_SYMBOL(wake_up_atomic_t); |
505 | |||
506 | __sched int bit_wait(struct wait_bit_key *word) | ||
507 | { | ||
508 | if (signal_pending_state(current->state, current)) | ||
509 | return 1; | ||
510 | schedule(); | ||
511 | return 0; | ||
512 | } | ||
513 | EXPORT_SYMBOL(bit_wait); | ||
514 | |||
515 | __sched int bit_wait_io(struct wait_bit_key *word) | ||
516 | { | ||
517 | if (signal_pending_state(current->state, current)) | ||
518 | return 1; | ||
519 | io_schedule(); | ||
520 | return 0; | ||
521 | } | ||
522 | EXPORT_SYMBOL(bit_wait_io); | ||