[PATCH] workqueue: update kerneldoc

From: Alan Stern
Date: Fri Oct 27 2006 - 11:28:36 EST


This patch (as812) changes the kerneldoc comments explaining the
return values from queue_work(), queue_delayed_work(), and
queue_delayed_work_on(). The updated comments explain more
accurately the meaning of the return code and avoid suggesting that a
0 value means the routine was unsuccessful.

Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

---

Andrew:

After seeing how queue_work() and schedule_work() are used in practice,
and in view of the recent discussion (concerning the PCI MWI routine)
about when it's appropriate to return an error code as opposed to just
returning a non-zero value, I decided there wasn't any need to change
queue_work() and friends.

The 0 value they return is not a sign of an error; it simply means
that the work_struct had already been added to a workqueue. The best way
to clear up any confusion is simply to improve the kerneldoc comment.

Alan Stern


Index: usb-2.6/kernel/workqueue.c
===================================================================
--- usb-2.6.orig/kernel/workqueue.c
+++ usb-2.6/kernel/workqueue.c
@@ -99,7 +99,7 @@ static void __queue_work(struct cpu_work
* @wq: workqueue to use
* @work: work to queue
*
- * Returns non-zero if it was successfully added.
+ * Returns 0 if @work was already on a queue, non-zero otherwise.
*
* We queue the work to the CPU it was submitted, but there is no
* guarantee that it will be processed by that CPU.
@@ -138,7 +138,7 @@ void delayed_work_timer_fn(unsigned long
* @work: work to queue
* @delay: number of jiffies to wait before queueing
*
- * Returns non-zero if it was successfully added.
+ * Returns 0 if @work was already on a queue, non-zero otherwise.
*/
int fastcall queue_delayed_work(struct workqueue_struct *wq,
struct work_struct *work, unsigned long delay)
@@ -170,7 +170,7 @@ EXPORT_SYMBOL_GPL(queue_delayed_work);
* @work: work to queue
* @delay: number of jiffies to wait before queueing
*
- * Returns non-zero if it was successfully added.
+ * Returns 0 if @work was already on a queue, non-zero otherwise.
*/
int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
struct work_struct *work, unsigned long delay)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/