summaryrefslogtreecommitdiff
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2007-05-09 02:34:18 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 12:30:52 -0700
commit1634c48f8b85dcb05101f1eb2eab9af40b5976da (patch)
tree143aa0fbf21e712a5258806b37f2024ba432b522 /kernel/workqueue.c
parenta848e3b67c07ed79374bd0f9b82f9ce45a419643 (diff)
downloadlwn-1634c48f8b85dcb05101f1eb2eab9af40b5976da.tar.gz
lwn-1634c48f8b85dcb05101f1eb2eab9af40b5976da.zip
make cancel_rearming_delayed_work() work on any workqueue, not just keventd_wq
cancel_rearming_delayed_workqueue(wq, dwork) doesn't need the first parameter. We don't hang on un-queued dwork any longer, and work->data doesn't change its type. This means we can always figure out "wq" from dwork when it is needed. Remove this parameter, and rename the function to cancel_rearming_delayed_work(). Re-create an inline "obsolete" cancel_rearming_delayed_workqueue(wq) which just calls cancel_rearming_delayed_work(). Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 985902e2e071..41eaffd125ca 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -555,32 +555,23 @@ void flush_work_keventd(struct work_struct *work)
EXPORT_SYMBOL(flush_work_keventd);
/**
- * cancel_rearming_delayed_workqueue - kill off a delayed work whose handler rearms the delayed work.
- * @wq: the controlling workqueue structure
+ * cancel_rearming_delayed_work - kill off a delayed work whose handler rearms the delayed work.
* @dwork: the delayed work struct
*
* Note that the work callback function may still be running on return from
* cancel_delayed_work(). Run flush_workqueue() or flush_work() to wait on it.
*/
-void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
- struct delayed_work *dwork)
+void cancel_rearming_delayed_work(struct delayed_work *dwork)
{
- /* Was it ever queued ? */
- if (!get_wq_data(&dwork->work))
- return;
+ struct cpu_workqueue_struct *cwq = get_wq_data(&dwork->work);
- while (!cancel_delayed_work(dwork))
- flush_workqueue(wq);
-}
-EXPORT_SYMBOL(cancel_rearming_delayed_workqueue);
+ /* Was it ever queued ? */
+ if (cwq != NULL) {
+ struct workqueue_struct *wq = cwq->wq;
-/**
- * cancel_rearming_delayed_work - kill off a delayed keventd work whose handler rearms the delayed work.
- * @dwork: the delayed work struct
- */
-void cancel_rearming_delayed_work(struct delayed_work *dwork)
-{
- cancel_rearming_delayed_workqueue(keventd_wq, dwork);
+ while (!cancel_delayed_work(dwork))
+ flush_workqueue(wq);
+ }
}
EXPORT_SYMBOL(cancel_rearming_delayed_work);