diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/wait.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/kernel/wait.c b/kernel/wait.c index ebb3da44dc12..1ca53daecd91 100644 --- a/kernel/wait.c +++ b/kernel/wait.c @@ -152,13 +152,15 @@ EXPORT_SYMBOL(wake_bit_function); */ int __sched fastcall __wait_on_bit(wait_queue_head_t *wq, struct wait_bit_queue *q, - void *word, int bit, int (*action)(void *), unsigned mode) + int (*action)(void *), unsigned mode) { int ret = 0; - prepare_to_wait(wq, &q->wait, mode); - if (test_bit(bit, word)) - ret = (*action)(word); + do { + prepare_to_wait(wq, &q->wait, mode); + if (test_bit(q->key.bit_nr, q->key.flags)) + ret = (*action)(q->key.flags); + } while (test_bit(q->key.bit_nr, q->key.flags) && !ret); finish_wait(wq, &q->wait); return ret; } @@ -170,23 +172,23 @@ int __sched fastcall out_of_line_wait_on_bit(void *word, int bit, wait_queue_head_t *wq = bit_waitqueue(word, bit); DEFINE_WAIT_BIT(wait, word, bit); - return __wait_on_bit(wq, &wait, word, bit, action, mode); + return __wait_on_bit(wq, &wait, action, mode); } EXPORT_SYMBOL(out_of_line_wait_on_bit); int __sched fastcall __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, - void *word, int bit, int (*action)(void *), unsigned mode) + int (*action)(void *), unsigned mode) { int ret = 0; do { prepare_to_wait_exclusive(wq, &q->wait, mode); - if (test_bit(bit, word)) { - if ((ret = (*action)(word))) + if (test_bit(q->key.bit_nr, q->key.flags)) { + if ((ret = (*action)(q->key.flags))) break; } - } while (test_and_set_bit(bit, word)); + } while (test_and_set_bit(q->key.bit_nr, q->key.flags)); finish_wait(wq, &q->wait); return ret; } @@ -198,7 +200,7 @@ int __sched fastcall out_of_line_wait_on_bit_lock(void *word, int bit, wait_queue_head_t *wq = bit_waitqueue(word, bit); DEFINE_WAIT_BIT(wait, word, bit); - return __wait_on_bit_lock(wq, &wait, word, bit, action, mode); + return __wait_on_bit_lock(wq, &wait, action, mode); } EXPORT_SYMBOL(out_of_line_wait_on_bit_lock); |
