diff options
author | Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | 2006-06-28 16:50:33 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-06-30 01:33:31 -0400 |
commit | 7a6bc1cdd506cf81f856f0fef4e56a2ba0c5a26d (patch) | |
tree | 610e6ad60d447838c3e26d00458eea04523daa5e /kernel | |
parent | ccb2fe209dac9ff67f6351e783e610073afaaeaf (diff) |
[CPUFREQ] Add queue_delayed_work_on() interface for workqueues.
Add queue_delayed_work_on() interface for workqueues.
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/workqueue.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 59f0b42bd89e..8fbef7008a7e 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -148,6 +148,27 @@ int fastcall queue_delayed_work(struct workqueue_struct *wq, | |||
148 | return ret; | 148 | return ret; |
149 | } | 149 | } |
150 | 150 | ||
151 | int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | ||
152 | struct work_struct *work, unsigned long delay) | ||
153 | { | ||
154 | int ret = 0; | ||
155 | struct timer_list *timer = &work->timer; | ||
156 | |||
157 | if (!test_and_set_bit(0, &work->pending)) { | ||
158 | BUG_ON(timer_pending(timer)); | ||
159 | BUG_ON(!list_empty(&work->entry)); | ||
160 | |||
161 | /* This stores wq for the moment, for the timer_fn */ | ||
162 | work->wq_data = wq; | ||
163 | timer->expires = jiffies + delay; | ||
164 | timer->data = (unsigned long)work; | ||
165 | timer->function = delayed_work_timer_fn; | ||
166 | add_timer_on(timer, cpu); | ||
167 | ret = 1; | ||
168 | } | ||
169 | return ret; | ||
170 | } | ||
171 | |||
151 | static void run_workqueue(struct cpu_workqueue_struct *cwq) | 172 | static void run_workqueue(struct cpu_workqueue_struct *cwq) |
152 | { | 173 | { |
153 | unsigned long flags; | 174 | unsigned long flags; |
@@ -411,21 +432,7 @@ int fastcall schedule_delayed_work(struct work_struct *work, unsigned long delay | |||
411 | int schedule_delayed_work_on(int cpu, | 432 | int schedule_delayed_work_on(int cpu, |
412 | struct work_struct *work, unsigned long delay) | 433 | struct work_struct *work, unsigned long delay) |
413 | { | 434 | { |
414 | int ret = 0; | 435 | return queue_delayed_work_on(cpu, keventd_wq, work, delay); |
415 | struct timer_list *timer = &work->timer; | ||
416 | |||
417 | if (!test_and_set_bit(0, &work->pending)) { | ||
418 | BUG_ON(timer_pending(timer)); | ||
419 | BUG_ON(!list_empty(&work->entry)); | ||
420 | /* This stores keventd_wq for the moment, for the timer_fn */ | ||
421 | work->wq_data = keventd_wq; | ||
422 | timer->expires = jiffies + delay; | ||
423 | timer->data = (unsigned long)work; | ||
424 | timer->function = delayed_work_timer_fn; | ||
425 | add_timer_on(timer, cpu); | ||
426 | ret = 1; | ||
427 | } | ||
428 | return ret; | ||
429 | } | 436 | } |
430 | 437 | ||
431 | /** | 438 | /** |
@@ -622,6 +629,7 @@ void init_workqueues(void) | |||
622 | EXPORT_SYMBOL_GPL(__create_workqueue); | 629 | EXPORT_SYMBOL_GPL(__create_workqueue); |
623 | EXPORT_SYMBOL_GPL(queue_work); | 630 | EXPORT_SYMBOL_GPL(queue_work); |
624 | EXPORT_SYMBOL_GPL(queue_delayed_work); | 631 | EXPORT_SYMBOL_GPL(queue_delayed_work); |
632 | EXPORT_SYMBOL_GPL(queue_delayed_work_on); | ||
625 | EXPORT_SYMBOL_GPL(flush_workqueue); | 633 | EXPORT_SYMBOL_GPL(flush_workqueue); |
626 | EXPORT_SYMBOL_GPL(destroy_workqueue); | 634 | EXPORT_SYMBOL_GPL(destroy_workqueue); |
627 | 635 | ||