diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-16 18:58:25 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-10-18 11:04:25 -0400 |
commit | 32a6c7233c41216f5dd41fc7bf100eedb1063dfc (patch) | |
tree | 188c87d2527c73807c330e65e2702f01ed149d76 | |
parent | c310ce4dcb9df9b2f1be82caff7dae609fe53f72 (diff) |
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.)
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Link: https://lkml.kernel.org/r/20171016225825.GA99101@beast
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | kernel/workqueue.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c77fdf6bf24f..6e5eed58f215 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -1831,9 +1831,9 @@ static void destroy_worker(struct worker *worker) | |||
1831 | wake_up_process(worker->task); | 1831 | wake_up_process(worker->task); |
1832 | } | 1832 | } |
1833 | 1833 | ||
1834 | static void idle_worker_timeout(unsigned long __pool) | 1834 | static void idle_worker_timeout(struct timer_list *t) |
1835 | { | 1835 | { |
1836 | struct worker_pool *pool = (void *)__pool; | 1836 | struct worker_pool *pool = from_timer(pool, t, idle_timer); |
1837 | 1837 | ||
1838 | spin_lock_irq(&pool->lock); | 1838 | spin_lock_irq(&pool->lock); |
1839 | 1839 | ||
@@ -1879,9 +1879,9 @@ static void send_mayday(struct work_struct *work) | |||
1879 | } | 1879 | } |
1880 | } | 1880 | } |
1881 | 1881 | ||
1882 | static void pool_mayday_timeout(unsigned long __pool) | 1882 | static void pool_mayday_timeout(struct timer_list *t) |
1883 | { | 1883 | { |
1884 | struct worker_pool *pool = (void *)__pool; | 1884 | struct worker_pool *pool = from_timer(pool, t, mayday_timer); |
1885 | struct work_struct *work; | 1885 | struct work_struct *work; |
1886 | 1886 | ||
1887 | spin_lock_irq(&pool->lock); | 1887 | spin_lock_irq(&pool->lock); |
@@ -3241,11 +3241,9 @@ static int init_worker_pool(struct worker_pool *pool) | |||
3241 | INIT_LIST_HEAD(&pool->idle_list); | 3241 | INIT_LIST_HEAD(&pool->idle_list); |
3242 | hash_init(pool->busy_hash); | 3242 | hash_init(pool->busy_hash); |
3243 | 3243 | ||
3244 | setup_deferrable_timer(&pool->idle_timer, idle_worker_timeout, | 3244 | timer_setup(&pool->idle_timer, idle_worker_timeout, TIMER_DEFERRABLE); |
3245 | (unsigned long)pool); | ||
3246 | 3245 | ||
3247 | setup_timer(&pool->mayday_timer, pool_mayday_timeout, | 3246 | timer_setup(&pool->mayday_timer, pool_mayday_timeout, 0); |
3248 | (unsigned long)pool); | ||
3249 | 3247 | ||
3250 | mutex_init(&pool->manager_arb); | 3248 | mutex_init(&pool->manager_arb); |
3251 | mutex_init(&pool->attach_mutex); | 3249 | mutex_init(&pool->attach_mutex); |