iwlegacy: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Tue, 24 Oct 2017 09:28:45 +0000 (02:28 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 27 Oct 2017 07:44:48 +0000 (10:44 +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: Kalle Valo <kvalo@codeaurora.org>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
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/intel/iwlegacy/3945-mac.c
drivers/net/wireless/intel/iwlegacy/3945-rs.c
drivers/net/wireless/intel/iwlegacy/4965-mac.c
drivers/net/wireless/intel/iwlegacy/common.c
drivers/net/wireless/intel/iwlegacy/common.h

index 329f3a63dadd6e5f8ab2c3991481cd0997b1e265..4b53ebf00c7ff195c3668679bced4c9adecdccf1 100644 (file)
@@ -3429,7 +3429,7 @@ il3945_setup_deferred_work(struct il_priv *il)
 
        il3945_hw_setup_deferred_work(il);
 
-       setup_timer(&il->watchdog, il_bg_watchdog, (unsigned long)il);
+       timer_setup(&il->watchdog, il_bg_watchdog, 0);
 
        tasklet_init(&il->irq_tasklet,
                     (void (*)(unsigned long))il3945_irq_tasklet,
index b2f35dfbc01bd6a98b92c342b56ccf6f0550ab8a..e8983c6a2b7bc4e082a8248fa265600e246738cb 100644 (file)
@@ -181,9 +181,9 @@ il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
 #define IL_AVERAGE_PACKETS             1500
 
 static void
-il3945_bg_rate_scale_flush(unsigned long data)
+il3945_bg_rate_scale_flush(struct timer_list *t)
 {
-       struct il3945_rs_sta *rs_sta = (void *)data;
+       struct il3945_rs_sta *rs_sta = from_timer(rs_sta, t, rate_scale_flush);
        struct il_priv *il __maybe_unused = rs_sta->il;
        int unflushed = 0;
        unsigned long flags;
@@ -360,9 +360,6 @@ il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id)
        rs_sta->flush_time = RATE_FLUSH;
        rs_sta->last_tx_packets = 0;
 
-       rs_sta->rate_scale_flush.data = (unsigned long)rs_sta;
-       rs_sta->rate_scale_flush.function = il3945_bg_rate_scale_flush;
-
        for (i = 0; i < RATE_COUNT_3945; i++)
                il3945_clear_win(&rs_sta->win[i]);
 
@@ -415,8 +412,7 @@ il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t gfp)
        rs_sta = &psta->rs_sta;
 
        spin_lock_init(&rs_sta->lock);
-       init_timer(&rs_sta->rate_scale_flush);
-
+       timer_setup(&rs_sta->rate_scale_flush, il3945_bg_rate_scale_flush, 0);
        D_RATE("leave\n");
 
        return rs_sta;
index 65eba2c24292e0653c21c4fc19431d404cc76eea..de63f2518f23f4be6d3dda9ee9d5f41f58de979d 100644 (file)
@@ -4074,9 +4074,9 @@ il4965_hdl_alive(struct il_priv *il, struct il_rx_buf *rxb)
  * used for calibrating the TXPOWER.
  */
 static void
-il4965_bg_stats_periodic(unsigned long data)
+il4965_bg_stats_periodic(struct timer_list *t)
 {
-       struct il_priv *il = (struct il_priv *)data;
+       struct il_priv *il = from_timer(il, t, stats_periodic);
 
        if (test_bit(S_EXIT_PENDING, &il->status))
                return;
@@ -6258,10 +6258,9 @@ il4965_setup_deferred_work(struct il_priv *il)
 
        INIT_WORK(&il->txpower_work, il4965_bg_txpower_work);
 
-       setup_timer(&il->stats_periodic, il4965_bg_stats_periodic,
-                   (unsigned long)il);
+       timer_setup(&il->stats_periodic, il4965_bg_stats_periodic, 0);
 
-       setup_timer(&il->watchdog, il_bg_watchdog, (unsigned long)il);
+       timer_setup(&il->watchdog, il_bg_watchdog, 0);
 
        tasklet_init(&il->irq_tasklet,
                     (void (*)(unsigned long))il4965_irq_tasklet,
index 8d5acda92a9b819eb00e159790f796bbcbe1cf27..558bb16bfd46476328276104df799301c1bc15b8 100644 (file)
@@ -4844,9 +4844,9 @@ il_check_stuck_queue(struct il_priv *il, int cnt)
  * we reset the firmware. If everything is fine just rearm the timer.
  */
 void
-il_bg_watchdog(unsigned long data)
+il_bg_watchdog(struct timer_list *t)
 {
-       struct il_priv *il = (struct il_priv *)data;
+       struct il_priv *il = from_timer(il, t, watchdog);
        int cnt;
        unsigned long timeout;
 
index 18c60c92e3a35c79338d55bf1dfeb8d9fcb7a2ff..dc6a74a0598388d1fcc90519b8c000eaf09c380c 100644 (file)
@@ -1832,7 +1832,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd);
  * PCI                                              *
  *****************************************************/
 
-void il_bg_watchdog(unsigned long data);
+void il_bg_watchdog(struct timer_list *t);
 u32 il_usecs_to_beacons(struct il_priv *il, u32 usec, u32 beacon_interval);
 __le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon,
                          u32 beacon_interval);