]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - kernel/workqueue.c
scsi: qla2xxx: Convert timers to use timer_setup()
[mirror_ubuntu-bionic-kernel.git] / kernel / workqueue.c
index 64d0edf428f850f2e5cfed94970cb74491eb6b61..6e5eed58f215db9f29939f930251c54cbeebdd72 100644 (file)
@@ -1492,9 +1492,9 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq,
 }
 EXPORT_SYMBOL(queue_work_on);
 
-void delayed_work_timer_fn(unsigned long __data)
+void delayed_work_timer_fn(struct timer_list *t)
 {
-       struct delayed_work *dwork = (struct delayed_work *)__data;
+       struct delayed_work *dwork = from_timer(dwork, t, timer);
 
        /* should have been called from irqsafe timer with irq already off */
        __queue_work(dwork->cpu, dwork->wq, &dwork->work);
@@ -1508,8 +1508,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
        struct work_struct *work = &dwork->work;
 
        WARN_ON_ONCE(!wq);
-       WARN_ON_ONCE(timer->function != delayed_work_timer_fn ||
-                    timer->data != (unsigned long)dwork);
+       WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)delayed_work_timer_fn);
        WARN_ON_ONCE(timer_pending(timer));
        WARN_ON_ONCE(!list_empty(&work->entry));
 
@@ -1832,9 +1831,9 @@ static void destroy_worker(struct worker *worker)
        wake_up_process(worker->task);
 }
 
-static void idle_worker_timeout(unsigned long __pool)
+static void idle_worker_timeout(struct timer_list *t)
 {
-       struct worker_pool *pool = (void *)__pool;
+       struct worker_pool *pool = from_timer(pool, t, idle_timer);
 
        spin_lock_irq(&pool->lock);
 
@@ -1880,9 +1879,9 @@ static void send_mayday(struct work_struct *work)
        }
 }
 
-static void pool_mayday_timeout(unsigned long __pool)
+static void pool_mayday_timeout(struct timer_list *t)
 {
-       struct worker_pool *pool = (void *)__pool;
+       struct worker_pool *pool = from_timer(pool, t, mayday_timer);
        struct work_struct *work;
 
        spin_lock_irq(&pool->lock);
@@ -3242,11 +3241,9 @@ static int init_worker_pool(struct worker_pool *pool)
        INIT_LIST_HEAD(&pool->idle_list);
        hash_init(pool->busy_hash);
 
-       setup_deferrable_timer(&pool->idle_timer, idle_worker_timeout,
-                              (unsigned long)pool);
+       timer_setup(&pool->idle_timer, idle_worker_timeout, TIMER_DEFERRABLE);
 
-       setup_timer(&pool->mayday_timer, pool_mayday_timeout,
-                   (unsigned long)pool);
+       timer_setup(&pool->mayday_timer, pool_mayday_timeout, 0);
 
        mutex_init(&pool->manager_arb);
        mutex_init(&pool->attach_mutex);
@@ -5390,11 +5387,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq)      { }
  */
 #ifdef CONFIG_WQ_WATCHDOG
 
-static void wq_watchdog_timer_fn(unsigned long data);
-
 static unsigned long wq_watchdog_thresh = 30;
-static struct timer_list wq_watchdog_timer =
-       TIMER_DEFERRED_INITIALIZER(wq_watchdog_timer_fn, 0, 0);
+static struct timer_list wq_watchdog_timer;
 
 static unsigned long wq_watchdog_touched = INITIAL_JIFFIES;
 static DEFINE_PER_CPU(unsigned long, wq_watchdog_touched_cpu) = INITIAL_JIFFIES;
@@ -5408,7 +5402,7 @@ static void wq_watchdog_reset_touched(void)
                per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
 }
 
-static void wq_watchdog_timer_fn(unsigned long data)
+static void wq_watchdog_timer_fn(struct timer_list *unused)
 {
        unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ;
        bool lockup_detected = false;
@@ -5510,6 +5504,7 @@ module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh,
 
 static void wq_watchdog_init(void)
 {
+       timer_setup(&wq_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE);
        wq_watchdog_set_thresh(wq_watchdog_thresh);
 }