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.
Showing the changes to kernel/workqueue.c (1 of 2 files). Show all
Unified · Split
| @@ -1492,9 +1492,9 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq, · 1491 unmodified lines | ||
| 1492 | 1492 | } |
| 1493 | 1493 | EXPORT_SYMBOL(queue_work_on); |
| 1494 | 1494 | |
| 1495 | −void delayed_work_timer_fn(unsigned long __data) | |
| 1495 | +void 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 | 1499 | /* should have been called from irqsafe timer with irq already off */ |
| 1500 | 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 | 1508 | struct work_struct *work = &dwork->work; |
| 1509 | 1509 | |
| 1510 | 1510 | 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); | |
| 1513 | 1512 | WARN_ON_ONCE(timer_pending(timer)); |
| 1514 | 1513 | WARN_ON_ONCE(!list_empty(&work->entry)); |
| 1515 | 1514 | |