sched/wait: Re-adjust macro line continuation backslashes in <linux/wait.h>
So there's over 300 CPP macro line-continuation backslashes in include/linux/wait.h (!!), which are aligned vertically to make the macro maze a bit more navigable. The recent renames and reorganization broke some of them, and instead of re-aligning them in every patch (which would add a lot of stylistic noise to the patches and make them less readable), I just ignored them - and fixed them up in a single go in this patch. Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
@@ -122,13 +122,13 @@ init_waitqueue_func_entry(struct wait_queue_entry *wq_entry, wait_queue_func_t f
|
|||||||
* CPU0 - waker CPU1 - waiter
|
* CPU0 - waker CPU1 - waiter
|
||||||
*
|
*
|
||||||
* for (;;) {
|
* for (;;) {
|
||||||
* @cond = true; prepare_to_wait(&wq, &wait, state);
|
* @cond = true; prepare_to_wait(&wq_head, &wait, state);
|
||||||
* smp_mb(); // smp_mb() from set_current_state()
|
* smp_mb(); // smp_mb() from set_current_state()
|
||||||
* if (waitqueue_active(wq)) if (@cond)
|
* if (waitqueue_active(wq_head)) if (@cond)
|
||||||
* wake_up(wq); break;
|
* wake_up(wq_head); break;
|
||||||
* schedule();
|
* schedule();
|
||||||
* }
|
* }
|
||||||
* finish_wait(&wq, &wait);
|
* finish_wait(&wq_head, &wait);
|
||||||
*
|
*
|
||||||
* Because without the explicit smp_mb() it's possible for the
|
* Because without the explicit smp_mb() it's possible for the
|
||||||
* waitqueue_active() load to get hoisted over the @cond store such that we'll
|
* waitqueue_active() load to get hoisted over the @cond store such that we'll
|
||||||
@@ -144,9 +144,9 @@ static inline int waitqueue_active(struct wait_queue_head *wq_head)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* wq_has_sleeper - check if there are any waiting processes
|
* wq_has_sleeper - check if there are any waiting processes
|
||||||
* @wq: wait queue head
|
* @wq_head: wait queue head
|
||||||
*
|
*
|
||||||
* Returns true if wq has waiting processes
|
* Returns true if wq_head has waiting processes
|
||||||
*
|
*
|
||||||
* Please refer to the comment for waitqueue_active.
|
* Please refer to the comment for waitqueue_active.
|
||||||
*/
|
*/
|
||||||
@@ -266,15 +266,15 @@ extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags);
|
|||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define ___wait_event(wq, condition, state, exclusive, ret, cmd) \
|
#define ___wait_event(wq_head, condition, state, exclusive, ret, cmd) \
|
||||||
({ \
|
({ \
|
||||||
__label__ __out; \
|
__label__ __out; \
|
||||||
struct wait_queue_entry __wq_entry; \
|
struct wait_queue_entry __wq_entry; \
|
||||||
long __ret = ret; /* explicit shadow */ \
|
long __ret = ret; /* explicit shadow */ \
|
||||||
\
|
\
|
||||||
init_wait_entry(&__wq_entry, exclusive ? WQ_FLAG_EXCLUSIVE : 0);\
|
init_wait_entry(&__wq_entry, exclusive ? WQ_FLAG_EXCLUSIVE : 0); \
|
||||||
for (;;) { \
|
for (;;) { \
|
||||||
long __int = prepare_to_wait_event(&wq, &__wq_entry, state);\
|
long __int = prepare_to_wait_event(&wq_head, &__wq_entry, state);\
|
||||||
\
|
\
|
||||||
if (condition) \
|
if (condition) \
|
||||||
break; \
|
break; \
|
||||||
@@ -286,88 +286,88 @@ extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags);
|
|||||||
\
|
\
|
||||||
cmd; \
|
cmd; \
|
||||||
} \
|
} \
|
||||||
finish_wait(&wq, &__wq_entry); \
|
finish_wait(&wq_head, &__wq_entry); \
|
||||||
__out: __ret; \
|
__out: __ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __wait_event(wq, condition) \
|
#define __wait_event(wq_head, condition) \
|
||||||
(void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
|
(void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
|
||||||
schedule())
|
schedule())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wait_event - sleep until a condition gets true
|
* wait_event - sleep until a condition gets true
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true. The @condition is checked each time
|
* @condition evaluates to true. The @condition is checked each time
|
||||||
* the waitqueue @wq is woken up.
|
* the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
*/
|
*/
|
||||||
#define wait_event(wq, condition) \
|
#define wait_event(wq_head, condition) \
|
||||||
do { \
|
do { \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (condition) \
|
if (condition) \
|
||||||
break; \
|
break; \
|
||||||
__wait_event(wq, condition); \
|
__wait_event(wq_head, condition); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define __io_wait_event(wq, condition) \
|
#define __io_wait_event(wq_head, condition) \
|
||||||
(void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
|
(void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
|
||||||
io_schedule())
|
io_schedule())
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* io_wait_event() -- like wait_event() but with io_schedule()
|
* io_wait_event() -- like wait_event() but with io_schedule()
|
||||||
*/
|
*/
|
||||||
#define io_wait_event(wq, condition) \
|
#define io_wait_event(wq_head, condition) \
|
||||||
do { \
|
do { \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (condition) \
|
if (condition) \
|
||||||
break; \
|
break; \
|
||||||
__io_wait_event(wq, condition); \
|
__io_wait_event(wq_head, condition); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define __wait_event_freezable(wq, condition) \
|
#define __wait_event_freezable(wq_head, condition) \
|
||||||
___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
|
___wait_event(wq_head, condition, TASK_INTERRUPTIBLE, 0, 0, \
|
||||||
schedule(); try_to_freeze())
|
schedule(); try_to_freeze())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wait_event_freezable - sleep (or freeze) until a condition gets true
|
* wait_event_freezable - sleep (or freeze) until a condition gets true
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contribute
|
* The process is put to sleep (TASK_INTERRUPTIBLE -- so as not to contribute
|
||||||
* to system load) until the @condition evaluates to true. The
|
* to system load) until the @condition evaluates to true. The
|
||||||
* @condition is checked each time the waitqueue @wq is woken up.
|
* @condition is checked each time the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
*/
|
*/
|
||||||
#define wait_event_freezable(wq, condition) \
|
#define wait_event_freezable(wq_head, condition) \
|
||||||
({ \
|
({ \
|
||||||
int __ret = 0; \
|
int __ret = 0; \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (!(condition)) \
|
if (!(condition)) \
|
||||||
__ret = __wait_event_freezable(wq, condition); \
|
__ret = __wait_event_freezable(wq_head, condition); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __wait_event_timeout(wq, condition, timeout) \
|
#define __wait_event_timeout(wq_head, condition, timeout) \
|
||||||
___wait_event(wq, ___wait_cond_timeout(condition), \
|
___wait_event(wq_head, ___wait_cond_timeout(condition), \
|
||||||
TASK_UNINTERRUPTIBLE, 0, timeout, \
|
TASK_UNINTERRUPTIBLE, 0, timeout, \
|
||||||
__ret = schedule_timeout(__ret))
|
__ret = schedule_timeout(__ret))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wait_event_timeout - sleep until a condition gets true or a timeout elapses
|
* wait_event_timeout - sleep until a condition gets true or a timeout elapses
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @timeout: timeout, in jiffies
|
* @timeout: timeout, in jiffies
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true. The @condition is checked each time
|
* @condition evaluates to true. The @condition is checked each time
|
||||||
* the waitqueue @wq is woken up.
|
* the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -378,17 +378,17 @@ do { \
|
|||||||
* or the remaining jiffies (at least 1) if the @condition evaluated
|
* or the remaining jiffies (at least 1) if the @condition evaluated
|
||||||
* to %true before the @timeout elapsed.
|
* to %true before the @timeout elapsed.
|
||||||
*/
|
*/
|
||||||
#define wait_event_timeout(wq, condition, timeout) \
|
#define wait_event_timeout(wq_head, condition, timeout) \
|
||||||
({ \
|
({ \
|
||||||
long __ret = timeout; \
|
long __ret = timeout; \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (!___wait_cond_timeout(condition)) \
|
if (!___wait_cond_timeout(condition)) \
|
||||||
__ret = __wait_event_timeout(wq, condition, timeout); \
|
__ret = __wait_event_timeout(wq_head, condition, timeout); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __wait_event_freezable_timeout(wq, condition, timeout) \
|
#define __wait_event_freezable_timeout(wq_head, condition, timeout) \
|
||||||
___wait_event(wq, ___wait_cond_timeout(condition), \
|
___wait_event(wq_head, ___wait_cond_timeout(condition), \
|
||||||
TASK_INTERRUPTIBLE, 0, timeout, \
|
TASK_INTERRUPTIBLE, 0, timeout, \
|
||||||
__ret = schedule_timeout(__ret); try_to_freeze())
|
__ret = schedule_timeout(__ret); try_to_freeze())
|
||||||
|
|
||||||
@@ -396,65 +396,65 @@ do { \
|
|||||||
* like wait_event_timeout() -- except it uses TASK_INTERRUPTIBLE to avoid
|
* like wait_event_timeout() -- except it uses TASK_INTERRUPTIBLE to avoid
|
||||||
* increasing load and is freezable.
|
* increasing load and is freezable.
|
||||||
*/
|
*/
|
||||||
#define wait_event_freezable_timeout(wq, condition, timeout) \
|
#define wait_event_freezable_timeout(wq_head, condition, timeout) \
|
||||||
({ \
|
({ \
|
||||||
long __ret = timeout; \
|
long __ret = timeout; \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (!___wait_cond_timeout(condition)) \
|
if (!___wait_cond_timeout(condition)) \
|
||||||
__ret = __wait_event_freezable_timeout(wq, condition, timeout); \
|
__ret = __wait_event_freezable_timeout(wq_head, condition, timeout); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __wait_event_exclusive_cmd(wq, condition, cmd1, cmd2) \
|
#define __wait_event_exclusive_cmd(wq_head, condition, cmd1, cmd2) \
|
||||||
(void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 1, 0, \
|
(void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 1, 0, \
|
||||||
cmd1; schedule(); cmd2)
|
cmd1; schedule(); cmd2)
|
||||||
/*
|
/*
|
||||||
* Just like wait_event_cmd(), except it sets exclusive flag
|
* Just like wait_event_cmd(), except it sets exclusive flag
|
||||||
*/
|
*/
|
||||||
#define wait_event_exclusive_cmd(wq, condition, cmd1, cmd2) \
|
#define wait_event_exclusive_cmd(wq_head, condition, cmd1, cmd2) \
|
||||||
do { \
|
do { \
|
||||||
if (condition) \
|
if (condition) \
|
||||||
break; \
|
break; \
|
||||||
__wait_event_exclusive_cmd(wq, condition, cmd1, cmd2); \
|
__wait_event_exclusive_cmd(wq_head, condition, cmd1, cmd2); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define __wait_event_cmd(wq, condition, cmd1, cmd2) \
|
#define __wait_event_cmd(wq_head, condition, cmd1, cmd2) \
|
||||||
(void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
|
(void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
|
||||||
cmd1; schedule(); cmd2)
|
cmd1; schedule(); cmd2)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wait_event_cmd - sleep until a condition gets true
|
* wait_event_cmd - sleep until a condition gets true
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @cmd1: the command will be executed before sleep
|
* @cmd1: the command will be executed before sleep
|
||||||
* @cmd2: the command will be executed after sleep
|
* @cmd2: the command will be executed after sleep
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true. The @condition is checked each time
|
* @condition evaluates to true. The @condition is checked each time
|
||||||
* the waitqueue @wq is woken up.
|
* the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
*/
|
*/
|
||||||
#define wait_event_cmd(wq, condition, cmd1, cmd2) \
|
#define wait_event_cmd(wq_head, condition, cmd1, cmd2) \
|
||||||
do { \
|
do { \
|
||||||
if (condition) \
|
if (condition) \
|
||||||
break; \
|
break; \
|
||||||
__wait_event_cmd(wq, condition, cmd1, cmd2); \
|
__wait_event_cmd(wq_head, condition, cmd1, cmd2); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define __wait_event_interruptible(wq, condition) \
|
#define __wait_event_interruptible(wq_head, condition) \
|
||||||
___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
|
___wait_event(wq_head, condition, TASK_INTERRUPTIBLE, 0, 0, \
|
||||||
schedule())
|
schedule())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wait_event_interruptible - sleep until a condition gets true
|
* wait_event_interruptible - sleep until a condition gets true
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true or a signal is received.
|
* @condition evaluates to true or a signal is received.
|
||||||
* The @condition is checked each time the waitqueue @wq is woken up.
|
* The @condition is checked each time the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -462,29 +462,29 @@ do { \
|
|||||||
* The function will return -ERESTARTSYS if it was interrupted by a
|
* The function will return -ERESTARTSYS if it was interrupted by a
|
||||||
* signal and 0 if @condition evaluated to true.
|
* signal and 0 if @condition evaluated to true.
|
||||||
*/
|
*/
|
||||||
#define wait_event_interruptible(wq, condition) \
|
#define wait_event_interruptible(wq_head, condition) \
|
||||||
({ \
|
({ \
|
||||||
int __ret = 0; \
|
int __ret = 0; \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (!(condition)) \
|
if (!(condition)) \
|
||||||
__ret = __wait_event_interruptible(wq, condition); \
|
__ret = __wait_event_interruptible(wq_head, condition); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __wait_event_interruptible_timeout(wq, condition, timeout) \
|
#define __wait_event_interruptible_timeout(wq_head, condition, timeout) \
|
||||||
___wait_event(wq, ___wait_cond_timeout(condition), \
|
___wait_event(wq_head, ___wait_cond_timeout(condition), \
|
||||||
TASK_INTERRUPTIBLE, 0, timeout, \
|
TASK_INTERRUPTIBLE, 0, timeout, \
|
||||||
__ret = schedule_timeout(__ret))
|
__ret = schedule_timeout(__ret))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
|
* wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @timeout: timeout, in jiffies
|
* @timeout: timeout, in jiffies
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true or a signal is received.
|
* @condition evaluates to true or a signal is received.
|
||||||
* The @condition is checked each time the waitqueue @wq is woken up.
|
* The @condition is checked each time the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -496,30 +496,29 @@ do { \
|
|||||||
* to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
|
* to %true before the @timeout elapsed, or -%ERESTARTSYS if it was
|
||||||
* interrupted by a signal.
|
* interrupted by a signal.
|
||||||
*/
|
*/
|
||||||
#define wait_event_interruptible_timeout(wq, condition, timeout) \
|
#define wait_event_interruptible_timeout(wq_head, condition, timeout) \
|
||||||
({ \
|
({ \
|
||||||
long __ret = timeout; \
|
long __ret = timeout; \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (!___wait_cond_timeout(condition)) \
|
if (!___wait_cond_timeout(condition)) \
|
||||||
__ret = __wait_event_interruptible_timeout(wq, \
|
__ret = __wait_event_interruptible_timeout(wq_head, \
|
||||||
condition, timeout); \
|
condition, timeout); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __wait_event_hrtimeout(wq, condition, timeout, state) \
|
#define __wait_event_hrtimeout(wq_head, condition, timeout, state) \
|
||||||
({ \
|
({ \
|
||||||
int __ret = 0; \
|
int __ret = 0; \
|
||||||
struct hrtimer_sleeper __t; \
|
struct hrtimer_sleeper __t; \
|
||||||
\
|
\
|
||||||
hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, \
|
hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); \
|
||||||
HRTIMER_MODE_REL); \
|
|
||||||
hrtimer_init_sleeper(&__t, current); \
|
hrtimer_init_sleeper(&__t, current); \
|
||||||
if ((timeout) != KTIME_MAX) \
|
if ((timeout) != KTIME_MAX) \
|
||||||
hrtimer_start_range_ns(&__t.timer, timeout, \
|
hrtimer_start_range_ns(&__t.timer, timeout, \
|
||||||
current->timer_slack_ns, \
|
current->timer_slack_ns, \
|
||||||
HRTIMER_MODE_REL); \
|
HRTIMER_MODE_REL); \
|
||||||
\
|
\
|
||||||
__ret = ___wait_event(wq, condition, state, 0, 0, \
|
__ret = ___wait_event(wq_head, condition, state, 0, 0, \
|
||||||
if (!__t.task) { \
|
if (!__t.task) { \
|
||||||
__ret = -ETIME; \
|
__ret = -ETIME; \
|
||||||
break; \
|
break; \
|
||||||
@@ -533,13 +532,13 @@ do { \
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* wait_event_hrtimeout - sleep until a condition gets true or a timeout elapses
|
* wait_event_hrtimeout - sleep until a condition gets true or a timeout elapses
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @timeout: timeout, as a ktime_t
|
* @timeout: timeout, as a ktime_t
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true or a signal is received.
|
* @condition evaluates to true or a signal is received.
|
||||||
* The @condition is checked each time the waitqueue @wq is woken up.
|
* The @condition is checked each time the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -547,25 +546,25 @@ do { \
|
|||||||
* The function returns 0 if @condition became true, or -ETIME if the timeout
|
* The function returns 0 if @condition became true, or -ETIME if the timeout
|
||||||
* elapsed.
|
* elapsed.
|
||||||
*/
|
*/
|
||||||
#define wait_event_hrtimeout(wq, condition, timeout) \
|
#define wait_event_hrtimeout(wq_head, condition, timeout) \
|
||||||
({ \
|
({ \
|
||||||
int __ret = 0; \
|
int __ret = 0; \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (!(condition)) \
|
if (!(condition)) \
|
||||||
__ret = __wait_event_hrtimeout(wq, condition, timeout, \
|
__ret = __wait_event_hrtimeout(wq_head, condition, timeout, \
|
||||||
TASK_UNINTERRUPTIBLE); \
|
TASK_UNINTERRUPTIBLE); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses
|
* wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @timeout: timeout, as a ktime_t
|
* @timeout: timeout, as a ktime_t
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true or a signal is received.
|
* @condition evaluates to true or a signal is received.
|
||||||
* The @condition is checked each time the waitqueue @wq is woken up.
|
* The @condition is checked each time the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -592,7 +591,7 @@ do { \
|
|||||||
int __ret = 0; \
|
int __ret = 0; \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (!(condition)) \
|
if (!(condition)) \
|
||||||
__ret = __wait_event_interruptible_exclusive(wq, condition);\
|
__ret = __wait_event_interruptible_exclusive(wq, condition); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -619,7 +618,7 @@ do { \
|
|||||||
int __ret = 0; \
|
int __ret = 0; \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (!(condition)) \
|
if (!(condition)) \
|
||||||
__ret = __wait_event_freezable_exclusive(wq, condition);\
|
__ret = __wait_event_freezable_exclusive(wq, condition); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -778,18 +777,18 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
|
|||||||
* The function will return -ERESTARTSYS if it was interrupted by a
|
* The function will return -ERESTARTSYS if it was interrupted by a
|
||||||
* signal and 0 if @condition evaluated to true.
|
* signal and 0 if @condition evaluated to true.
|
||||||
*/
|
*/
|
||||||
#define wait_event_killable(wq, condition) \
|
#define wait_event_killable(wq_head, condition) \
|
||||||
({ \
|
({ \
|
||||||
int __ret = 0; \
|
int __ret = 0; \
|
||||||
might_sleep(); \
|
might_sleep(); \
|
||||||
if (!(condition)) \
|
if (!(condition)) \
|
||||||
__ret = __wait_event_killable(wq, condition); \
|
__ret = __wait_event_killable(wq_head, condition); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
#define __wait_event_lock_irq(wq, condition, lock, cmd) \
|
#define __wait_event_lock_irq(wq_head, condition, lock, cmd) \
|
||||||
(void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
|
(void)___wait_event(wq_head, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
|
||||||
spin_unlock_irq(&lock); \
|
spin_unlock_irq(&lock); \
|
||||||
cmd; \
|
cmd; \
|
||||||
schedule(); \
|
schedule(); \
|
||||||
@@ -800,7 +799,7 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
|
|||||||
* condition is checked under the lock. This
|
* condition is checked under the lock. This
|
||||||
* is expected to be called with the lock
|
* is expected to be called with the lock
|
||||||
* taken.
|
* taken.
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @lock: a locked spinlock_t, which will be released before cmd
|
* @lock: a locked spinlock_t, which will be released before cmd
|
||||||
* and schedule() and reacquired afterwards.
|
* and schedule() and reacquired afterwards.
|
||||||
@@ -809,7 +808,7 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
|
|||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true. The @condition is checked each time
|
* @condition evaluates to true. The @condition is checked each time
|
||||||
* the waitqueue @wq is woken up.
|
* the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -818,11 +817,11 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
|
|||||||
* dropped before invoking the cmd and going to sleep and is reacquired
|
* dropped before invoking the cmd and going to sleep and is reacquired
|
||||||
* afterwards.
|
* afterwards.
|
||||||
*/
|
*/
|
||||||
#define wait_event_lock_irq_cmd(wq, condition, lock, cmd) \
|
#define wait_event_lock_irq_cmd(wq_head, condition, lock, cmd) \
|
||||||
do { \
|
do { \
|
||||||
if (condition) \
|
if (condition) \
|
||||||
break; \
|
break; \
|
||||||
__wait_event_lock_irq(wq, condition, lock, cmd); \
|
__wait_event_lock_irq(wq_head, condition, lock, cmd); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -830,14 +829,14 @@ do { \
|
|||||||
* condition is checked under the lock. This
|
* condition is checked under the lock. This
|
||||||
* is expected to be called with the lock
|
* is expected to be called with the lock
|
||||||
* taken.
|
* taken.
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @lock: a locked spinlock_t, which will be released before schedule()
|
* @lock: a locked spinlock_t, which will be released before schedule()
|
||||||
* and reacquired afterwards.
|
* and reacquired afterwards.
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true. The @condition is checked each time
|
* @condition evaluates to true. The @condition is checked each time
|
||||||
* the waitqueue @wq is woken up.
|
* the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -845,16 +844,16 @@ do { \
|
|||||||
* This is supposed to be called while holding the lock. The lock is
|
* This is supposed to be called while holding the lock. The lock is
|
||||||
* dropped before going to sleep and is reacquired afterwards.
|
* dropped before going to sleep and is reacquired afterwards.
|
||||||
*/
|
*/
|
||||||
#define wait_event_lock_irq(wq, condition, lock) \
|
#define wait_event_lock_irq(wq_head, condition, lock) \
|
||||||
do { \
|
do { \
|
||||||
if (condition) \
|
if (condition) \
|
||||||
break; \
|
break; \
|
||||||
__wait_event_lock_irq(wq, condition, lock, ); \
|
__wait_event_lock_irq(wq_head, condition, lock, ); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define __wait_event_interruptible_lock_irq(wq, condition, lock, cmd) \
|
#define __wait_event_interruptible_lock_irq(wq_head, condition, lock, cmd) \
|
||||||
___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
|
___wait_event(wq_head, condition, TASK_INTERRUPTIBLE, 0, 0, \
|
||||||
spin_unlock_irq(&lock); \
|
spin_unlock_irq(&lock); \
|
||||||
cmd; \
|
cmd; \
|
||||||
schedule(); \
|
schedule(); \
|
||||||
@@ -864,7 +863,7 @@ do { \
|
|||||||
* wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
|
* wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
|
||||||
* The condition is checked under the lock. This is expected to
|
* The condition is checked under the lock. This is expected to
|
||||||
* be called with the lock taken.
|
* be called with the lock taken.
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @lock: a locked spinlock_t, which will be released before cmd and
|
* @lock: a locked spinlock_t, which will be released before cmd and
|
||||||
* schedule() and reacquired afterwards.
|
* schedule() and reacquired afterwards.
|
||||||
@@ -873,7 +872,7 @@ do { \
|
|||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true or a signal is received. The @condition is
|
* @condition evaluates to true or a signal is received. The @condition is
|
||||||
* checked each time the waitqueue @wq is woken up.
|
* checked each time the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -885,11 +884,11 @@ do { \
|
|||||||
* The macro will return -ERESTARTSYS if it was interrupted by a signal
|
* The macro will return -ERESTARTSYS if it was interrupted by a signal
|
||||||
* and 0 if @condition evaluated to true.
|
* and 0 if @condition evaluated to true.
|
||||||
*/
|
*/
|
||||||
#define wait_event_interruptible_lock_irq_cmd(wq, condition, lock, cmd) \
|
#define wait_event_interruptible_lock_irq_cmd(wq_head, condition, lock, cmd) \
|
||||||
({ \
|
({ \
|
||||||
int __ret = 0; \
|
int __ret = 0; \
|
||||||
if (!(condition)) \
|
if (!(condition)) \
|
||||||
__ret = __wait_event_interruptible_lock_irq(wq, \
|
__ret = __wait_event_interruptible_lock_irq(wq_head, \
|
||||||
condition, lock, cmd); \
|
condition, lock, cmd); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
@@ -898,14 +897,14 @@ do { \
|
|||||||
* wait_event_interruptible_lock_irq - sleep until a condition gets true.
|
* wait_event_interruptible_lock_irq - sleep until a condition gets true.
|
||||||
* The condition is checked under the lock. This is expected
|
* The condition is checked under the lock. This is expected
|
||||||
* to be called with the lock taken.
|
* to be called with the lock taken.
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @lock: a locked spinlock_t, which will be released before schedule()
|
* @lock: a locked spinlock_t, which will be released before schedule()
|
||||||
* and reacquired afterwards.
|
* and reacquired afterwards.
|
||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true or signal is received. The @condition is
|
* @condition evaluates to true or signal is received. The @condition is
|
||||||
* checked each time the waitqueue @wq is woken up.
|
* checked each time the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -916,18 +915,18 @@ do { \
|
|||||||
* The macro will return -ERESTARTSYS if it was interrupted by a signal
|
* The macro will return -ERESTARTSYS if it was interrupted by a signal
|
||||||
* and 0 if @condition evaluated to true.
|
* and 0 if @condition evaluated to true.
|
||||||
*/
|
*/
|
||||||
#define wait_event_interruptible_lock_irq(wq, condition, lock) \
|
#define wait_event_interruptible_lock_irq(wq_head, condition, lock) \
|
||||||
({ \
|
({ \
|
||||||
int __ret = 0; \
|
int __ret = 0; \
|
||||||
if (!(condition)) \
|
if (!(condition)) \
|
||||||
__ret = __wait_event_interruptible_lock_irq(wq, \
|
__ret = __wait_event_interruptible_lock_irq(wq_head, \
|
||||||
condition, lock,); \
|
condition, lock,); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \
|
#define __wait_event_interruptible_lock_irq_timeout(wq_head, condition, \
|
||||||
lock, timeout) \
|
lock, timeout) \
|
||||||
___wait_event(wq, ___wait_cond_timeout(condition), \
|
___wait_event(wq_head, ___wait_cond_timeout(condition), \
|
||||||
TASK_INTERRUPTIBLE, 0, timeout, \
|
TASK_INTERRUPTIBLE, 0, timeout, \
|
||||||
spin_unlock_irq(&lock); \
|
spin_unlock_irq(&lock); \
|
||||||
__ret = schedule_timeout(__ret); \
|
__ret = schedule_timeout(__ret); \
|
||||||
@@ -937,7 +936,7 @@ do { \
|
|||||||
* wait_event_interruptible_lock_irq_timeout - sleep until a condition gets
|
* wait_event_interruptible_lock_irq_timeout - sleep until a condition gets
|
||||||
* true or a timeout elapses. The condition is checked under
|
* true or a timeout elapses. The condition is checked under
|
||||||
* the lock. This is expected to be called with the lock taken.
|
* the lock. This is expected to be called with the lock taken.
|
||||||
* @wq: the waitqueue to wait on
|
* @wq_head: the waitqueue to wait on
|
||||||
* @condition: a C expression for the event to wait for
|
* @condition: a C expression for the event to wait for
|
||||||
* @lock: a locked spinlock_t, which will be released before schedule()
|
* @lock: a locked spinlock_t, which will be released before schedule()
|
||||||
* and reacquired afterwards.
|
* and reacquired afterwards.
|
||||||
@@ -945,7 +944,7 @@ do { \
|
|||||||
*
|
*
|
||||||
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
* The process is put to sleep (TASK_INTERRUPTIBLE) until the
|
||||||
* @condition evaluates to true or signal is received. The @condition is
|
* @condition evaluates to true or signal is received. The @condition is
|
||||||
* checked each time the waitqueue @wq is woken up.
|
* checked each time the waitqueue @wq_head is woken up.
|
||||||
*
|
*
|
||||||
* wake_up() has to be called after changing any variable that could
|
* wake_up() has to be called after changing any variable that could
|
||||||
* change the result of the wait condition.
|
* change the result of the wait condition.
|
||||||
@@ -957,13 +956,13 @@ do { \
|
|||||||
* was interrupted by a signal, and the remaining jiffies otherwise
|
* was interrupted by a signal, and the remaining jiffies otherwise
|
||||||
* if the condition evaluated to true before the timeout elapsed.
|
* if the condition evaluated to true before the timeout elapsed.
|
||||||
*/
|
*/
|
||||||
#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \
|
#define wait_event_interruptible_lock_irq_timeout(wq_head, condition, lock, \
|
||||||
timeout) \
|
timeout) \
|
||||||
({ \
|
({ \
|
||||||
long __ret = timeout; \
|
long __ret = timeout; \
|
||||||
if (!___wait_cond_timeout(condition)) \
|
if (!___wait_cond_timeout(condition)) \
|
||||||
__ret = __wait_event_interruptible_lock_irq_timeout( \
|
__ret = __wait_event_interruptible_lock_irq_timeout( \
|
||||||
wq, condition, lock, timeout); \
|
wq_head, condition, lock, timeout); \
|
||||||
__ret; \
|
__ret; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user