Skip to contentSkip to conversation

schedule_work() documentation improvements

PATCH In review Bart Van Assche 1 participant 2 messages Jul 30, 2009 – Aug 4, 2009 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 schedule_work() documentation improvements

Two important aspects of the schedule_work() function are not yet documented:
- that it is allowed to pass a struct work_struct * to this function that is already on the kernel-global workqueue;
- the meaning of its return value.
The patch below documents both aspects.

Cc Greg Kroah-Hartman <[email protected]>
Cc Ingo Molnar <[email protected]>
kernel/workqueue.c renamed from linux-2.6.30/kernel/workqueue.c +5 -1
diff -uprN orig/linux-2.6.30/kernel/workqueue.c linux-2.6.30/kernel/workqueue.c
@@ -603,7 +603,11 @@ static struct workqueue_struct *keventd_
  * schedule_work - put work task in global workqueue
  * @work: job to be done
  *
- * This puts a job in the kernel-global workqueue.
+ * Returns zero if @work was already on the kernel-global workqueue and
+ * non-zero otherwise.
+ *
+ * This puts a job in the kernel-global workqueue if it was not already queued
+ * and leaves it in the same position on the kernel-global workqueue otherwise.
  */
 int schedule_work(struct work_struct *work)
 {
#1 lore raw

[tip:core/cleanups] workqueues: Improve schedule_work() documentation

Commit-ID:  5b0f437df0a3e374d26ad533eb78fe64744f55a8
Gitweb:     http://git.kernel.org/tip/5b0f437df0a3e374d26ad533eb78fe64744f55a8
Author:     Bart Van Assche <[email protected]>
AuthorDate: Thu, 30 Jul 2009 19:00:53 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 4 Aug 2009 15:21:16 +0200

workqueues: Improve schedule_work() documentation

Two important aspects of the schedule_work() function are not yet documented:

- that it is allowed to pass a struct work_struct * to this function that is already on the kernel-global workqueue;

- the meaning of its return value.

The patch below documents both aspects.

Cc "Greg Kroah-Hartman" <[email protected]>
Cc Andrew Morton <[email protected]>

LKML-Reference: <[email protected]>

---
 kernel/workqueue.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
kernel/workqueue.c +6 -1
index 0668795..3c44b56 100644
@@ -600,7 +600,12 @@ static struct workqueue_struct *keventd_wq __read_mostly;
  * schedule_work - put work task in global workqueue
  * @work: job to be done
  *
- * This puts a job in the kernel-global workqueue.
+ * Returns zero if @work was already on the kernel-global workqueue and
+ * non-zero otherwise.
+ *
+ * This puts a job in the kernel-global workqueue if it was not already
+ * queued and leaves it in the same position on the kernel-global
+ * workqueue otherwise.
  */
 int schedule_work(struct work_struct *work)
 {