diff options
Diffstat (limited to 'include/linux/wait.h')
-rw-r--r-- | include/linux/wait.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index 2232ed16635a..537d58eea8a0 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -363,7 +363,6 @@ do { \ | |||
363 | */ | 363 | */ |
364 | #define wait_event_cmd(wq, condition, cmd1, cmd2) \ | 364 | #define wait_event_cmd(wq, condition, cmd1, cmd2) \ |
365 | do { \ | 365 | do { \ |
366 | might_sleep(); \ | ||
367 | if (condition) \ | 366 | if (condition) \ |
368 | break; \ | 367 | break; \ |
369 | __wait_event_cmd(wq, condition, cmd1, cmd2); \ | 368 | __wait_event_cmd(wq, condition, cmd1, cmd2); \ |
@@ -991,6 +990,32 @@ wait_on_bit_io(void *word, int bit, unsigned mode) | |||
991 | } | 990 | } |
992 | 991 | ||
993 | /** | 992 | /** |
993 | * wait_on_bit_timeout - wait for a bit to be cleared or a timeout elapses | ||
994 | * @word: the word being waited on, a kernel virtual address | ||
995 | * @bit: the bit of the word being waited on | ||
996 | * @mode: the task state to sleep in | ||
997 | * @timeout: timeout, in jiffies | ||
998 | * | ||
999 | * Use the standard hashed waitqueue table to wait for a bit | ||
1000 | * to be cleared. This is similar to wait_on_bit(), except also takes a | ||
1001 | * timeout parameter. | ||
1002 | * | ||
1003 | * Returned value will be zero if the bit was cleared before the | ||
1004 | * @timeout elapsed, or non-zero if the @timeout elapsed or process | ||
1005 | * received a signal and the mode permitted wakeup on that signal. | ||
1006 | */ | ||
1007 | static inline int | ||
1008 | wait_on_bit_timeout(void *word, int bit, unsigned mode, unsigned long timeout) | ||
1009 | { | ||
1010 | might_sleep(); | ||
1011 | if (!test_bit(bit, word)) | ||
1012 | return 0; | ||
1013 | return out_of_line_wait_on_bit_timeout(word, bit, | ||
1014 | bit_wait_timeout, | ||
1015 | mode, timeout); | ||
1016 | } | ||
1017 | |||
1018 | /** | ||
994 | * wait_on_bit_action - wait for a bit to be cleared | 1019 | * wait_on_bit_action - wait for a bit to be cleared |
995 | * @word: the word being waited on, a kernel virtual address | 1020 | * @word: the word being waited on, a kernel virtual address |
996 | * @bit: the bit of the word being waited on | 1021 | * @bit: the bit of the word being waited on |