History

workqueue: Convert timers to use timer_setup() (part 2)

In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. (The prior workqueue patch missed a few timers.)

Kees Cook committed 9 years ago

Commit 32a6c721 parent c310ce41 file · +6 −8Browse files

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

Unified · Split

kernel/workqueue.c+6−8
@@ -1831,9 +1831,9 @@ static void destroy_worker(struct worker *worker) · 1830 unmodified lines
18311831 wake_up_process(worker->task);
18321832 }
18331833
1834−static void idle_worker_timeout(unsigned long __pool)
1834+static void idle_worker_timeout(struct timer_list *t)
18351835 {
1836− struct worker_pool *pool = (void *)__pool;
1836+ struct worker_pool *pool = from_timer(pool, t, idle_timer);
18371837
18381838 spin_lock_irq(&pool->lock);
18391839
@@ -1879,9 +1879,9 @@ static void send_mayday(struct work_struct *work) · 39 unmodified lines
18791879 }
18801880 }
18811881
1882−static void pool_mayday_timeout(unsigned long __pool)
1882+static void pool_mayday_timeout(struct timer_list *t)
18831883 {
1884− struct worker_pool *pool = (void *)__pool;
1884+ struct worker_pool *pool = from_timer(pool, t, mayday_timer);
18851885 struct work_struct *work;
18861886
18871887 spin_lock_irq(&pool->lock);
@@ -3241,11 +3241,9 @@ static int init_worker_pool(struct worker_pool *pool) · 1353 unmodified lines
32413241 INIT_LIST_HEAD(&pool->idle_list);
32423242 hash_init(pool->busy_hash);
32433243
3244− setup_deferrable_timer(&pool->idle_timer, idle_worker_timeout,
3245− (unsigned long)pool);
3244+ timer_setup(&pool->idle_timer, idle_worker_timeout, TIMER_DEFERRABLE);
32463245
3247− setup_timer(&pool->mayday_timer, pool_mayday_timeout,
3248− (unsigned long)pool);
3246+ timer_setup(&pool->mayday_timer, pool_mayday_timeout, 0);
32493247
32503248 mutex_init(&pool->manager_arb);
32513249 mutex_init(&pool->attach_mutex);