[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>

authored by Venkatesh Pallipadi and committed by Dave Jones 7a6bc1cd ccb2fe20

+25 -15
+2
include/linux/workqueue.h
··· 63 63 64 64 extern int FASTCALL(queue_work(struct workqueue_struct *wq, struct work_struct *work)); 65 65 extern int FASTCALL(queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay)); 66 + extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, 67 + struct work_struct *work, unsigned long delay); 66 68 extern void FASTCALL(flush_workqueue(struct workqueue_struct *wq)); 67 69 68 70 extern int FASTCALL(schedule_work(struct work_struct *work));
+23 -15
kernel/workqueue.c
··· 148 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 172 static void run_workqueue(struct cpu_workqueue_struct *cwq) 152 173 { 153 174 unsigned long flags; ··· 432 411 int schedule_delayed_work_on(int cpu, 433 412 struct work_struct *work, unsigned long delay) 434 413 { 435 - int ret = 0; 436 - struct timer_list *timer = &work->timer; 437 - 438 - if (!test_and_set_bit(0, &work->pending)) { 439 - BUG_ON(timer_pending(timer)); 440 - BUG_ON(!list_empty(&work->entry)); 441 - /* This stores keventd_wq for the moment, for the timer_fn */ 442 - work->wq_data = keventd_wq; 443 - timer->expires = jiffies + delay; 444 - timer->data = (unsigned long)work; 445 - timer->function = delayed_work_timer_fn; 446 - add_timer_on(timer, cpu); 447 - ret = 1; 448 - } 449 - return ret; 414 + return queue_delayed_work_on(cpu, keventd_wq, work, delay); 450 415 } 451 416 452 417 /** ··· 629 622 EXPORT_SYMBOL_GPL(__create_workqueue); 630 623 EXPORT_SYMBOL_GPL(queue_work); 631 624 EXPORT_SYMBOL_GPL(queue_delayed_work); 625 + EXPORT_SYMBOL_GPL(queue_delayed_work_on); 632 626 EXPORT_SYMBOL_GPL(flush_workqueue); 633 627 EXPORT_SYMBOL_GPL(destroy_workqueue); 634 628