Commit 4b1c480b authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@kernel.org>
parent 939798a0
...@@ -53,34 +53,34 @@ struct task_struct; ...@@ -53,34 +53,34 @@ struct task_struct;
* Macros for declaration and initialisaton of the datatypes * Macros for declaration and initialisaton of the datatypes
*/ */
#define __WAITQUEUE_INITIALIZER(name, tsk) { \ #define __WAITQUEUE_INITIALIZER(name, tsk) { \
.private = tsk, \ .private = tsk, \
.func = default_wake_function, \ .func = default_wake_function, \
.task_list = { NULL, NULL } } .task_list = { NULL, NULL } }
#define DECLARE_WAITQUEUE(name, tsk) \ #define DECLARE_WAITQUEUE(name, tsk) \
struct wait_queue_entry name = __WAITQUEUE_INITIALIZER(name, tsk) struct wait_queue_entry name = __WAITQUEUE_INITIALIZER(name, tsk)
#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \ #define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \
.lock = __SPIN_LOCK_UNLOCKED(name.lock), \ .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
.task_list = { &(name).task_list, &(name).task_list } } .task_list = { &(name).task_list, &(name).task_list } }
#define DECLARE_WAIT_QUEUE_HEAD(name) \ #define DECLARE_WAIT_QUEUE_HEAD(name) \
struct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name) struct wait_queue_head name = __WAIT_QUEUE_HEAD_INITIALIZER(name)
#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \ #define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
{ .flags = word, .bit_nr = bit, } { .flags = word, .bit_nr = bit, }
#define __WAIT_ATOMIC_T_KEY_INITIALIZER(p) \ #define __WAIT_ATOMIC_T_KEY_INITIALIZER(p) \
{ .flags = p, .bit_nr = WAIT_ATOMIC_T_BIT_NR, } { .flags = p, .bit_nr = WAIT_ATOMIC_T_BIT_NR, }
extern void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *name, struct lock_class_key *); extern void __init_waitqueue_head(struct wait_queue_head *wq_head, const char *name, struct lock_class_key *);
#define init_waitqueue_head(wq_head) \ #define init_waitqueue_head(wq_head) \
do { \ do { \
static struct lock_class_key __key; \ static struct lock_class_key __key; \
\ \
__init_waitqueue_head((wq_head), #wq_head, &__key); \ __init_waitqueue_head((wq_head), #wq_head, &__key); \
} while (0) } while (0)
#ifdef CONFIG_LOCKDEP #ifdef CONFIG_LOCKDEP
...@@ -122,13 +122,13 @@ init_waitqueue_func_entry(struct wait_queue_entry *wq_entry, wait_queue_func_t f ...@@ -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) ...@@ -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.
*/ */
...@@ -231,26 +231,26 @@ struct wait_queue_head *bit_waitqueue(void *word, int bit); ...@@ -231,26 +231,26 @@ struct wait_queue_head *bit_waitqueue(void *word, int bit);
/* /*
* Wakeup macros to be used to report events to the targets. * Wakeup macros to be used to report events to the targets.
*/ */
#define wake_up_poll(x, m) \ #define wake_up_poll(x, m) \
__wake_up(x, TASK_NORMAL, 1, (void *) (m)) __wake_up(x, TASK_NORMAL, 1, (void *) (m))
#define wake_up_locked_poll(x, m) \ #define wake_up_locked_poll(x, m) \
__wake_up_locked_key((x), TASK_NORMAL, (void *) (m)) __wake_up_locked_key((x), TASK_NORMAL, (void *) (m))
#define wake_up_interruptible_poll(x, m) \ #define wake_up_interruptible_poll(x, m) \
__wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m)) __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m))
#define wake_up_interruptible_sync_poll(x, m) \ #define wake_up_interruptible_sync_poll(x, m) \
__wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m)) __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m))
#define ___wait_cond_timeout(condition) \ #define ___wait_cond_timeout(condition) \
({ \ ({ \
bool __cond = (condition); \ bool __cond = (condition); \
if (__cond && !__ret) \ if (__cond && !__ret) \
__ret = 1; \ __ret = 1; \
__cond || !__ret; \ __cond || !__ret; \
}) })
#define ___wait_is_interruptible(state) \ #define ___wait_is_interruptible(state) \
(!__builtin_constant_p(state) || \ (!__builtin_constant_p(state) || \
state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \ state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags); extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags);
...@@ -266,108 +266,108 @@ extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags); ...@@ -266,108 +266,108 @@ 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; \
\ \
if (___wait_is_interruptible(state) && __int) { \ if (___wait_is_interruptible(state) && __int) { \
__ret = __int; \ __ret = __int; \
goto __out; \ goto __out; \
} \ } \
\ \
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,83 +378,83 @@ do { \ ...@@ -378,83 +378,83 @@ 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())
/* /*
* 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 { \ ...@@ -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,50 +496,49 @@ do { \ ...@@ -496,50 +496,49 @@ 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_head, condition, state, 0, 0, \
__ret = ___wait_event(wq, condition, state, 0, 0, \ if (!__t.task) { \
if (!__t.task) { \ __ret = -ETIME; \
__ret = -ETIME; \ break; \
break; \ } \
} \ schedule()); \
schedule()); \ \
\ hrtimer_cancel(&__t.timer); \
hrtimer_cancel(&__t.timer); \ destroy_hrtimer_on_stack(&__t.timer); \
destroy_hrtimer_on_stack(&__t.timer); \ __ret; \
__ret; \
}) })
/** /**
* 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 { \ ...@@ -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.
...@@ -573,73 +572,73 @@ do { \ ...@@ -573,73 +572,73 @@ do { \
* The function returns 0 if @condition became true, -ERESTARTSYS if it was * The function returns 0 if @condition became true, -ERESTARTSYS if it was
* interrupted by a signal, or -ETIME if the timeout elapsed. * interrupted by a signal, or -ETIME if the timeout elapsed.
*/ */
#define wait_event_interruptible_hrtimeout(wq, condition, timeout) \ #define wait_event_interruptible_hrtimeout(wq, condition, timeout) \
({ \ ({ \
long __ret = 0; \ long __ret = 0; \
might_sleep(); \ might_sleep(); \
if (!(condition)) \ if (!(condition)) \
__ret = __wait_event_hrtimeout(wq, condition, timeout, \ __ret = __wait_event_hrtimeout(wq, condition, timeout, \
TASK_INTERRUPTIBLE); \ TASK_INTERRUPTIBLE); \
__ret; \ __ret; \
}) })
#define __wait_event_interruptible_exclusive(wq, condition) \ #define __wait_event_interruptible_exclusive(wq, condition) \
___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \ ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \
schedule()) schedule())
#define wait_event_interruptible_exclusive(wq, condition) \ #define wait_event_interruptible_exclusive(wq, condition) \
({ \ ({ \
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; \
}) })
#define __wait_event_killable_exclusive(wq, condition) \ #define __wait_event_killable_exclusive(wq, condition) \
___wait_event(wq, condition, TASK_KILLABLE, 1, 0, \ ___wait_event(wq, condition, TASK_KILLABLE, 1, 0, \
schedule()) schedule())
#define wait_event_killable_exclusive(wq, condition) \ #define wait_event_killable_exclusive(wq, condition) \
({ \ ({ \
int __ret = 0; \ int __ret = 0; \
might_sleep(); \ might_sleep(); \
if (!(condition)) \ if (!(condition)) \
__ret = __wait_event_killable_exclusive(wq, condition); \ __ret = __wait_event_killable_exclusive(wq, condition); \
__ret; \ __ret; \
}) })
#define __wait_event_freezable_exclusive(wq, condition) \ #define __wait_event_freezable_exclusive(wq, condition) \
___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \ ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \
schedule(); try_to_freeze()) schedule(); try_to_freeze())
#define wait_event_freezable_exclusive(wq, condition) \ #define wait_event_freezable_exclusive(wq, condition) \
({ \ ({ \
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; \
}) })
extern int do_wait_intr(wait_queue_head_t *, wait_queue_entry_t *); extern int do_wait_intr(wait_queue_head_t *, wait_queue_entry_t *);
extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
#define __wait_event_interruptible_locked(wq, condition, exclusive, fn) \ #define __wait_event_interruptible_locked(wq, condition, exclusive, fn) \
({ \ ({ \
int __ret; \ int __ret; \
DEFINE_WAIT(__wait); \ DEFINE_WAIT(__wait); \
if (exclusive) \ if (exclusive) \
__wait.flags |= WQ_FLAG_EXCLUSIVE; \ __wait.flags |= WQ_FLAG_EXCLUSIVE; \
do { \ do { \
__ret = fn(&(wq), &__wait); \ __ret = fn(&(wq), &__wait); \
if (__ret) \ if (__ret) \
break; \ break; \
} while (!(condition)); \ } while (!(condition)); \
__remove_wait_queue(&(wq), &__wait); \ __remove_wait_queue(&(wq), &__wait); \
__set_current_state(TASK_RUNNING); \ __set_current_state(TASK_RUNNING); \
__ret; \ __ret; \
}) })
...@@ -666,8 +665,8 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); ...@@ -666,8 +665,8 @@ 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_interruptible_locked(wq, condition) \ #define wait_event_interruptible_locked(wq, condition) \
((condition) \ ((condition) \
? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr)) ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr))
/** /**
...@@ -693,8 +692,8 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); ...@@ -693,8 +692,8 @@ 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_interruptible_locked_irq(wq, condition) \ #define wait_event_interruptible_locked_irq(wq, condition) \
((condition) \ ((condition) \
? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr_irq)) ? 0 : __wait_event_interruptible_locked(wq, condition, 0, do_wait_intr_irq))
/** /**
...@@ -724,8 +723,8 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); ...@@ -724,8 +723,8 @@ 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_interruptible_exclusive_locked(wq, condition) \ #define wait_event_interruptible_exclusive_locked(wq, condition) \
((condition) \ ((condition) \
? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr)) ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr))
/** /**
...@@ -755,12 +754,12 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); ...@@ -755,12 +754,12 @@ 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_interruptible_exclusive_locked_irq(wq, condition) \ #define wait_event_interruptible_exclusive_locked_irq(wq, condition) \
((condition) \ ((condition) \
? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr_irq)) ? 0 : __wait_event_interruptible_locked(wq, condition, 1, do_wait_intr_irq))
#define __wait_event_killable(wq, condition) \ #define __wait_event_killable(wq, condition) \
___wait_event(wq, condition, TASK_KILLABLE, 0, 0, schedule()) ___wait_event(wq, condition, TASK_KILLABLE, 0, 0, schedule())
/** /**
...@@ -778,21 +777,21 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); ...@@ -778,21 +777,21 @@ 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(); \
spin_lock_irq(&lock)) spin_lock_irq(&lock))
/** /**
...@@ -800,7 +799,7 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *); ...@@ -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 *); ...@@ -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 *); ...@@ -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 { \ ...@@ -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,26 +844,26 @@ do { \ ...@@ -845,26 +844,26 @@ 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(); \
spin_lock_irq(&lock)) spin_lock_irq(&lock))
/** /**
* 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 { \ ...@@ -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,27 +884,27 @@ do { \ ...@@ -885,27 +884,27 @@ 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; \
}) })
/** /**
* 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,28 +915,28 @@ do { \ ...@@ -916,28 +915,28 @@ 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); \
spin_lock_irq(&lock)); spin_lock_irq(&lock));
/** /**
* 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 { \ ...@@ -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,14 +956,14 @@ do { \ ...@@ -957,14 +956,14 @@ 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; \
}) })
/* /*
...@@ -979,32 +978,32 @@ int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sy ...@@ -979,32 +978,32 @@ int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sy
int autoremove_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key); int autoremove_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key);
int wake_bit_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key); int wake_bit_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key);
#define DEFINE_WAIT_FUNC(name, function) \ #define DEFINE_WAIT_FUNC(name, function) \
struct wait_queue_entry name = { \ struct wait_queue_entry name = { \
.private = current, \ .private = current, \
.func = function, \ .func = function, \
.task_list = LIST_HEAD_INIT((name).task_list), \ .task_list = LIST_HEAD_INIT((name).task_list), \
} }
#define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, autoremove_wake_function) #define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, autoremove_wake_function)
#define DEFINE_WAIT_BIT(name, word, bit) \ #define DEFINE_WAIT_BIT(name, word, bit) \
struct wait_bit_queue_entry name = { \ struct wait_bit_queue_entry name = { \
.key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \
.wq_entry = { \ .wq_entry = { \
.private = current, \ .private = current, \
.func = wake_bit_function, \ .func = wake_bit_function, \
.task_list = \ .task_list = \
LIST_HEAD_INIT((name).wq_entry.task_list), \ LIST_HEAD_INIT((name).wq_entry.task_list), \
}, \ }, \
} }
#define init_wait(wait) \ #define init_wait(wait) \
do { \ do { \
(wait)->private = current; \ (wait)->private = current; \
(wait)->func = autoremove_wake_function; \ (wait)->func = autoremove_wake_function; \
INIT_LIST_HEAD(&(wait)->task_list); \ INIT_LIST_HEAD(&(wait)->task_list); \
(wait)->flags = 0; \ (wait)->flags = 0; \
} while (0) } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment