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
1492}1492}
1493EXPORT_SYMBOL(queue_work_on);1493EXPORT_SYMBOL(queue_work_on);
1494 1494
1495void delayed_work_timer_fn(unsigned long __data)1495void delayed_work_timer_fn(struct timer_list *t)
1496{1496{
1497 struct delayed_work *dwork = (struct delayed_work *)__data;1497 struct delayed_work *dwork = from_timer(dwork, t, timer);
1498 1498
1499 /* should have been called from irqsafe timer with irq already off */1499 /* should have been called from irqsafe timer with irq already off */
1500 __queue_work(dwork->cpu, dwork->wq, &dwork->work);1500 __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
1508 struct work_struct *work = &dwork->work;1508 struct work_struct *work = &dwork->work;
1509 1509
1510 WARN_ON_ONCE(!wq);1510 WARN_ON_ONCE(!wq);
1511 WARN_ON_ONCE(timer->function != delayed_work_timer_fn ||1511 WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)delayed_work_timer_fn);
1512 timer->data != (unsigned long)dwork);
1513 WARN_ON_ONCE(timer_pending(timer));1512 WARN_ON_ONCE(timer_pending(timer));
1514 WARN_ON_ONCE(!list_empty(&work->entry));1513 WARN_ON_ONCE(!list_empty(&work->entry));
1515 1514