History

[CPUFREQ] Add queue_delayed_work_on() interface for workqueues.

Add queue_delayed_work_on() interface for workqueues.

Venkatesh Pallipadi committed 20 years ago

Commit 7a6bc1c1 parent ccb2fe22 files · +25 −15Browse files

Showing the changes to kernel/workqueue.c (1 of 2 files). Show all

Unified · Split

kernel/workqueue.c+23−15
@@ -148,6 +148,27 @@ int fastcall queue_delayed_work(struct workqueue_struct *wq, · 147 unmodified lines
148148 return ret;
149149 }
150150
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+
151172 static void run_workqueue(struct cpu_workqueue_struct *cwq)
152173 {
153174 unsigned long flags;
@@ -411,21 +432,7 @@ int fastcall schedule_delayed_work(struct work_struct *work, unsigned long delay · 257 unmodified lines
411432 int schedule_delayed_work_on(int cpu,
412433 struct work_struct *work, unsigned long delay)
413434 {
414− int ret = 0;
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;
435+ return queue_delayed_work_on(cpu, keventd_wq, work, delay);
429436 }
430437
431438 /**
@@ -622,6 +629,7 @@ void init_workqueues(void) · 190 unmodified lines
622629 EXPORT_SYMBOL_GPL(__create_workqueue);
623630 EXPORT_SYMBOL_GPL(queue_work);
624631 EXPORT_SYMBOL_GPL(queue_delayed_work);
632+EXPORT_SYMBOL_GPL(queue_delayed_work_on);
625633 EXPORT_SYMBOL_GPL(flush_workqueue);
626634 EXPORT_SYMBOL_GPL(destroy_workqueue);
627635