diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2007-05-09 05:34:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:52 -0400 |
commit | 1634c48f8b85dcb05101f1eb2eab9af40b5976da (patch) | |
tree | 143aa0fbf21e712a5258806b37f2024ba432b522 | |
parent | a848e3b67c07ed79374bd0f9b82f9ce45a419643 (diff) |
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>
-rw-r--r-- | include/linux/workqueue.h | 13 | ||||
-rw-r--r-- | kernel/workqueue.c | 27 |
2 files changed, 19 insertions, 21 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 2a58f16e1961..27110c04f21e 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -191,9 +191,6 @@ extern int current_is_keventd(void); | |||
191 | extern int keventd_up(void); | 191 | extern int keventd_up(void); |
192 | 192 | ||
193 | extern void init_workqueues(void); | 193 | extern void init_workqueues(void); |
194 | void cancel_rearming_delayed_work(struct delayed_work *work); | ||
195 | void cancel_rearming_delayed_workqueue(struct workqueue_struct *, | ||
196 | struct delayed_work *); | ||
197 | int execute_in_process_context(work_func_t fn, struct execute_work *); | 194 | int execute_in_process_context(work_func_t fn, struct execute_work *); |
198 | 195 | ||
199 | /* | 196 | /* |
@@ -212,4 +209,14 @@ static inline int cancel_delayed_work(struct delayed_work *work) | |||
212 | return ret; | 209 | return ret; |
213 | } | 210 | } |
214 | 211 | ||
212 | extern void cancel_rearming_delayed_work(struct delayed_work *work); | ||
213 | |||
214 | /* Obsolete. use cancel_rearming_delayed_work() */ | ||
215 | static inline | ||
216 | void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq, | ||
217 | struct delayed_work *work) | ||
218 | { | ||
219 | cancel_rearming_delayed_work(work); | ||
220 | } | ||
221 | |||
215 | #endif | 222 | #endif |
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) | |||
555 | EXPORT_SYMBOL(flush_work_keventd); | 555 | EXPORT_SYMBOL(flush_work_keventd); |
556 | 556 | ||
557 | /** | 557 | /** |
558 | * cancel_rearming_delayed_workqueue - kill off a delayed work whose handler rearms the delayed work. | 558 | * cancel_rearming_delayed_work - kill off a delayed work whose handler rearms the delayed work. |
559 | * @wq: the controlling workqueue structure | ||
560 | * @dwork: the delayed work struct | 559 | * @dwork: the delayed work struct |
561 | * | 560 | * |
562 | * Note that the work callback function may still be running on return from | 561 | * Note that the work callback function may still be running on return from |
563 | * cancel_delayed_work(). Run flush_workqueue() or flush_work() to wait on it. | 562 | * cancel_delayed_work(). Run flush_workqueue() or flush_work() to wait on it. |
564 | */ | 563 | */ |
565 | void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq, | 564 | void cancel_rearming_delayed_work(struct delayed_work *dwork) |
566 | struct delayed_work *dwork) | ||
567 | { | 565 | { |
568 | /* Was it ever queued ? */ | 566 | struct cpu_workqueue_struct *cwq = get_wq_data(&dwork->work); |
569 | if (!get_wq_data(&dwork->work)) | ||
570 | return; | ||
571 | 567 | ||
572 | while (!cancel_delayed_work(dwork)) | 568 | /* Was it ever queued ? */ |
573 | flush_workqueue(wq); | 569 | if (cwq != NULL) { |
574 | } | 570 | struct workqueue_struct *wq = cwq->wq; |
575 | EXPORT_SYMBOL(cancel_rearming_delayed_workqueue); | ||
576 | 571 | ||
577 | /** | 572 | while (!cancel_delayed_work(dwork)) |
578 | * cancel_rearming_delayed_work - kill off a delayed keventd work whose handler rearms the delayed work. | 573 | flush_workqueue(wq); |
579 | * @dwork: the delayed work struct | 574 | } |
580 | */ | ||
581 | void cancel_rearming_delayed_work(struct delayed_work *dwork) | ||
582 | { | ||
583 | cancel_rearming_delayed_workqueue(keventd_wq, dwork); | ||
584 | } | 575 | } |
585 | EXPORT_SYMBOL(cancel_rearming_delayed_work); | 576 | EXPORT_SYMBOL(cancel_rearming_delayed_work); |
586 | 577 | ||