aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>2006-06-28 16:50:33 -0400
committerDave Jones <davej@redhat.com>2006-06-30 01:33:31 -0400
commit7a6bc1cdd506cf81f856f0fef4e56a2ba0c5a26d (patch)
tree610e6ad60d447838c3e26d00458eea04523daa5e /kernel
parentccb2fe209dac9ff67f6351e783e610073afaaeaf (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.c38
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
151int 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
151static void run_workqueue(struct cpu_workqueue_struct *cwq) 172static 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
411int schedule_delayed_work_on(int cpu, 432int 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)
622EXPORT_SYMBOL_GPL(__create_workqueue); 629EXPORT_SYMBOL_GPL(__create_workqueue);
623EXPORT_SYMBOL_GPL(queue_work); 630EXPORT_SYMBOL_GPL(queue_work);
624EXPORT_SYMBOL_GPL(queue_delayed_work); 631EXPORT_SYMBOL_GPL(queue_delayed_work);
632EXPORT_SYMBOL_GPL(queue_delayed_work_on);
625EXPORT_SYMBOL_GPL(flush_workqueue); 633EXPORT_SYMBOL_GPL(flush_workqueue);
626EXPORT_SYMBOL_GPL(destroy_workqueue); 634EXPORT_SYMBOL_GPL(destroy_workqueue);
627 635