#define wake_up_interruptible_sync_poll(x, m) \
__wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m))
+#define ___wait_cond_timeout(condition, ret) \
+({ \
+ bool __cond = (condition); \
+ if (__cond && !ret) \
+ ret = 1; \
+ __cond || !ret; \
+})
+
#define __wait_event(wq, condition) \
do { \
DEFINE_WAIT(__wait); \
\
for (;;) { \
prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \
- if (condition) \
+ if (___wait_cond_timeout(condition, ret)) \
break; \
ret = schedule_timeout(ret); \
- if (!ret) \
- break; \
} \
- if (!ret && (condition)) \
- ret = 1; \
finish_wait(&wq, &__wait); \
} while (0)
\
for (;;) { \
prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
- if (condition) \
+ if (___wait_cond_timeout(condition, ret)) \
break; \
if (signal_pending(current)) { \
ret = -ERESTARTSYS; \
break; \
} \
ret = schedule_timeout(ret); \
- if (!ret) \
- break; \
} \
- if (!ret && (condition)) \
- ret = 1; \
finish_wait(&wq, &__wait); \
} while (0)
\
for (;;) { \
prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
- if (condition) \
+ if (___wait_cond_timeout(condition, ret)) \
break; \
if (signal_pending(current)) { \
ret = -ERESTARTSYS; \
spin_unlock_irq(&lock); \
ret = schedule_timeout(ret); \
spin_lock_irq(&lock); \
- if (!ret) \
- break; \
} \
finish_wait(&wq, &__wait); \
} while (0)