summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMartin Waitz <tali@admingilde.org>2005-03-11 16:38:06 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-03-11 16:38:06 -0800
commit543147290f76042a0b8ac9ff7aba05fe409d1a62 (patch)
treefb6e743643c7e8955ba709f331de819fa766c960 /include/linux
parent62c1de8c0c066f36d8e9d7d6a457eedff155bff5 (diff)
[PATCH] docbook: new kernel-doc comments for might_sleep & wait_event_*
New kernel-doc comments for might_sleep & wait_event_* Signed-off-by: Martin Waitz <tali@admingilde.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kernel.h12
-rw-r--r--include/linux/wait.h60
2 files changed, 71 insertions, 1 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index de56b8b26cd5..7bde43a23799 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -48,10 +48,20 @@ extern int console_printk[];
struct completion;
+/**
+ * might_sleep - annotation for functions that can sleep
+ *
+ * this macro will print a stack trace if it is executed in an atomic
+ * context (spinlock, irq-handler, ...).
+ *
+ * This is a useful debugging help to be able to catch problems early and not
+ * be biten later when the calling function happens to sleep when it is not
+ * supposed to.
+ */
#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
-void __might_sleep(char *file, int line);
#define might_sleep() __might_sleep(__FILE__, __LINE__)
#define might_sleep_if(cond) do { if (unlikely(cond)) might_sleep(); } while (0)
+void __might_sleep(char *file, int line);
#else
#define might_sleep() do {} while(0)
#define might_sleep_if(cond) do {} while (0)
diff --git a/include/linux/wait.h b/include/linux/wait.h
index ddb0a16f31c9..8401e623d791 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -169,6 +169,18 @@ do { \
finish_wait(&wq, &__wait); \
} while (0)
+/**
+ * wait_event - sleep until a condition gets true
+ * @wq: the waitqueue to wait on
+ * @condition: a C expression for the event to wait for
+ *
+ * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
+ * @condition evaluates to true. The @condition is checked each time
+ * the waitqueue @wq is woken up.
+ *
+ * wake_up() has to be called after changing any variable that could
+ * change the result of the wait condition.
+ */
#define wait_event(wq, condition) \
do { \
if (condition) \
@@ -191,6 +203,22 @@ do { \
finish_wait(&wq, &__wait); \
} while (0)
+/**
+ * wait_event_timeout - sleep until a condition gets true or a timeout elapses
+ * @wq: the waitqueue to wait on
+ * @condition: a C expression for the event to wait for
+ * @timeout: timeout, in jiffies
+ *
+ * The process is put to sleep (TASK_UNINTERRUPTIBLE) until the
+ * @condition evaluates to true. The @condition is checked each time
+ * the waitqueue @wq is woken up.
+ *
+ * wake_up() has to be called after changing any variable that could
+ * change the result of the wait condition.
+ *
+ * The function returns 0 if the @timeout elapsed, and the remaining
+ * jiffies if the condition evaluated to true before the timeout elapsed.
+ */
#define wait_event_timeout(wq, condition, timeout) \
({ \
long __ret = timeout; \
@@ -217,6 +245,21 @@ do { \
finish_wait(&wq, &__wait); \
} while (0)
+/**
+ * wait_event_interruptible - sleep until a condition gets true
+ * @wq: the waitqueue to wait on
+ * @condition: a C expression for the event to wait for
+ *
+ * The process is put to sleep (TASK_INTERRUPTIBLE) until the
+ * @condition evaluates to true or a signal is received.
+ * The @condition is checked each time the waitqueue @wq is woken up.
+ *
+ * wake_up() has to be called after changing any variable that could
+ * change the result of the wait condition.
+ *
+ * The function will return -ERESTARTSYS if it was interrupted by a
+ * signal and 0 if @condition evaluated to true.
+ */
#define wait_event_interruptible(wq, condition) \
({ \
int __ret = 0; \
@@ -245,6 +288,23 @@ do { \
finish_wait(&wq, &__wait); \
} while (0)
+/**
+ * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
+ * @wq: the waitqueue to wait on
+ * @condition: a C expression for the event to wait for
+ * @timeout: timeout, in jiffies
+ *
+ * The process is put to sleep (TASK_INTERRUPTIBLE) until the
+ * @condition evaluates to true or a signal is received.
+ * The @condition is checked each time the waitqueue @wq is woken up.
+ *
+ * wake_up() has to be called after changing any variable that could
+ * change the result of the wait condition.
+ *
+ * The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it
+ * was interrupted by a signal, and the remaining jiffies otherwise
+ * if the condition evaluated to true before the timeout elapsed.
+ */
#define wait_event_interruptible_timeout(wq, condition, timeout) \
({ \
long __ret = timeout; \