]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
make cancel_rearming_delayed_work() work on any workqueue, not just keventd_wq
authorOleg Nesterov <oleg@tv-sign.ru>
Wed, 9 May 2007 09:34:18 +0000 (02:34 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 9 May 2007 19:30:52 +0000 (12:30 -0700)
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>
include/linux/workqueue.h
kernel/workqueue.c

index 2a58f16e1961f1699fb9a690bafac3a585ee5711..27110c04f21ed6802597e3dc65a6f0fbc5651905 100644 (file)
@@ -191,9 +191,6 @@ extern int current_is_keventd(void);
 extern int keventd_up(void);
 
 extern void init_workqueues(void);
-void cancel_rearming_delayed_work(struct delayed_work *work);
-void cancel_rearming_delayed_workqueue(struct workqueue_struct *,
-                                      struct delayed_work *);
 int execute_in_process_context(work_func_t fn, struct execute_work *);
 
 /*
@@ -212,4 +209,14 @@ static inline int cancel_delayed_work(struct delayed_work *work)
        return ret;
 }
 
+extern void cancel_rearming_delayed_work(struct delayed_work *work);
+
+/* Obsolete. use cancel_rearming_delayed_work() */
+static inline
+void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
+                                       struct delayed_work *work)
+{
+       cancel_rearming_delayed_work(work);
+}
+
 #endif
index 985902e2e071e3775c26384528b778daf8d4d861..41eaffd125cad05f493601afe6e55a3c6fcb7070 100644 (file)
@@ -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);