cw1200: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Tue, 24 Oct 2017 09:29:00 +0000 (02:29 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 27 Oct 2017 07:46:24 +0000 (10:46 +0300)
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.

Cc: Solomon Peachy <pizza@shaftnet.org>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/st/cw1200/main.c
drivers/net/wireless/st/cw1200/queue.c
drivers/net/wireless/st/cw1200/sta.c
drivers/net/wireless/st/cw1200/sta.h

index dc478cedbde0d30f4588634b05fc529976e4ce9d..a186d1df1f2938682677fcc7f71f4b9897437d21 100644 (file)
@@ -373,8 +373,7 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr,
        INIT_WORK(&priv->update_filtering_work, cw1200_update_filtering_work);
        INIT_WORK(&priv->set_beacon_wakeup_period_work,
                  cw1200_set_beacon_wakeup_period_work);
-       setup_timer(&priv->mcast_timeout, cw1200_mcast_timeout,
-                   (unsigned long)priv);
+       timer_setup(&priv->mcast_timeout, cw1200_mcast_timeout, 0);
 
        if (cw1200_queue_stats_init(&priv->tx_queue_stats,
                                    CW1200_LINK_ID_MAX,
index 0ba5ef9b3e7b1373f76742b4842a19d8e227b578..5153d2cfd9915ebfe911f830f309deff20d10f97 100644 (file)
@@ -130,11 +130,11 @@ static void __cw1200_queue_gc(struct cw1200_queue *queue,
        }
 }
 
-static void cw1200_queue_gc(unsigned long arg)
+static void cw1200_queue_gc(struct timer_list *t)
 {
        LIST_HEAD(list);
        struct cw1200_queue *queue =
-               (struct cw1200_queue *)arg;
+               from_timer(queue, t, gc);
 
        spin_lock_bh(&queue->lock);
        __cw1200_queue_gc(queue, &list, true);
@@ -179,7 +179,7 @@ int cw1200_queue_init(struct cw1200_queue *queue,
        INIT_LIST_HEAD(&queue->pending);
        INIT_LIST_HEAD(&queue->free_pool);
        spin_lock_init(&queue->lock);
-       setup_timer(&queue->gc, cw1200_queue_gc, (unsigned long)queue);
+       timer_setup(&queue->gc, cw1200_queue_gc, 0);
 
        queue->pool = kzalloc(sizeof(struct cw1200_queue_item) * capacity,
                        GFP_KERNEL);
index a52224836a2bb65ba03fa5f7c3838c7f60346a7d..03687a80d6e983e4fd0b0a60db8c21695f595756 100644 (file)
@@ -2112,10 +2112,9 @@ void cw1200_multicast_stop_work(struct work_struct *work)
        }
 }
 
-void cw1200_mcast_timeout(unsigned long arg)
+void cw1200_mcast_timeout(struct timer_list *t)
 {
-       struct cw1200_common *priv =
-               (struct cw1200_common *)arg;
+       struct cw1200_common *priv = from_timer(priv, t, mcast_timeout);
 
        wiphy_warn(priv->hw->wiphy,
                   "Multicast delivery timeout.\n");
index a0bacaa39b3193f230c61526afe6bdc68f38b7a0..719de34dcbfe20a20fdf9e6e1a19fd54ca78d6ef 100644 (file)
@@ -117,6 +117,6 @@ void cw1200_set_tim_work(struct work_struct *work);
 void cw1200_set_cts_work(struct work_struct *work);
 void cw1200_multicast_start_work(struct work_struct *work);
 void cw1200_multicast_stop_work(struct work_struct *work);
-void cw1200_mcast_timeout(unsigned long arg);
+void cw1200_mcast_timeout(struct timer_list *t);
 
 #endif