diff options
Diffstat (limited to 'include/linux/wait.h')
-rw-r--r-- | include/linux/wait.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h index ac38be2692d8..1133695eb067 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -217,6 +217,8 @@ do { \ | |||
217 | if (!ret) \ | 217 | if (!ret) \ |
218 | break; \ | 218 | break; \ |
219 | } \ | 219 | } \ |
220 | if (!ret && (condition)) \ | ||
221 | ret = 1; \ | ||
220 | finish_wait(&wq, &__wait); \ | 222 | finish_wait(&wq, &__wait); \ |
221 | } while (0) | 223 | } while (0) |
222 | 224 | ||
@@ -233,8 +235,9 @@ do { \ | |||
233 | * wake_up() has to be called after changing any variable that could | 235 | * wake_up() has to be called after changing any variable that could |
234 | * change the result of the wait condition. | 236 | * change the result of the wait condition. |
235 | * | 237 | * |
236 | * The function returns 0 if the @timeout elapsed, and the remaining | 238 | * The function returns 0 if the @timeout elapsed, or the remaining |
237 | * jiffies if the condition evaluated to true before the timeout elapsed. | 239 | * jiffies (at least 1) if the @condition evaluated to %true before |
240 | * the @timeout elapsed. | ||
238 | */ | 241 | */ |
239 | #define wait_event_timeout(wq, condition, timeout) \ | 242 | #define wait_event_timeout(wq, condition, timeout) \ |
240 | ({ \ | 243 | ({ \ |
@@ -302,6 +305,8 @@ do { \ | |||
302 | ret = -ERESTARTSYS; \ | 305 | ret = -ERESTARTSYS; \ |
303 | break; \ | 306 | break; \ |
304 | } \ | 307 | } \ |
308 | if (!ret && (condition)) \ | ||
309 | ret = 1; \ | ||
305 | finish_wait(&wq, &__wait); \ | 310 | finish_wait(&wq, &__wait); \ |
306 | } while (0) | 311 | } while (0) |
307 | 312 | ||
@@ -318,9 +323,10 @@ do { \ | |||
318 | * wake_up() has to be called after changing any variable that could | 323 | * wake_up() has to be called after changing any variable that could |
319 | * change the result of the wait condition. | 324 | * change the result of the wait condition. |
320 | * | 325 | * |
321 | * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it | 326 | * Returns: |
322 | * was interrupted by a signal, and the remaining jiffies otherwise | 327 | * 0 if the @timeout elapsed, -%ERESTARTSYS if it was interrupted by |
323 | * if the condition evaluated to true before the timeout elapsed. | 328 | * a signal, or the remaining jiffies (at least 1) if the @condition |
329 | * evaluated to %true before the @timeout elapsed. | ||
324 | */ | 330 | */ |
325 | #define wait_event_interruptible_timeout(wq, condition, timeout) \ | 331 | #define wait_event_interruptible_timeout(wq, condition, timeout) \ |
326 | ({ \ | 332 | ({ \ |