History

workqueue: Convert callback to use from_timer()

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch workqueue to use from_timer() and pass the timer pointer explicitly.

Kees Cook committed 9 years ago

Commit 8c20feb1 parent fe5c3b62 files · +11 −11Browse files

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

Unified · Split

kernel/workqueue.c+3−4
@@ -1492,9 +1492,9 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq, · 1491 unmodified lines
14921492 }
14931493 EXPORT_SYMBOL(queue_work_on);
14941494
1495−void delayed_work_timer_fn(unsigned long __data)
1495+void delayed_work_timer_fn(struct timer_list *t)
14961496 {
1497− struct delayed_work *dwork = (struct delayed_work *)__data;
1497+ struct delayed_work *dwork = from_timer(dwork, t, timer);
14981498
14991499 /* should have been called from irqsafe timer with irq already off */
15001500 __queue_work(dwork->cpu, dwork->wq, &dwork->work);
@@ -1508,8 +1508,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq, · 7 unmodified lines
15081508 struct work_struct *work = &dwork->work;
15091509
15101510 WARN_ON_ONCE(!wq);
1511− WARN_ON_ONCE(timer->function != delayed_work_timer_fn ||
1512− timer->data != (unsigned long)dwork);
1511+ WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)delayed_work_timer_fn);
15131512 WARN_ON_ONCE(timer_pending(timer));
15141513 WARN_ON_ONCE(!list_empty(&work->entry));
15151514