Commit 2b77839b authored by Kees Cook's avatar Kees Cook Committed by Kalle Valo

iwlegacy: Convert timers to use timer_setup()

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: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 7e916caf
...@@ -3429,7 +3429,7 @@ il3945_setup_deferred_work(struct il_priv *il) ...@@ -3429,7 +3429,7 @@ il3945_setup_deferred_work(struct il_priv *il)
il3945_hw_setup_deferred_work(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, tasklet_init(&il->irq_tasklet,
(void (*)(unsigned long))il3945_irq_tasklet, (void (*)(unsigned long))il3945_irq_tasklet,
......
...@@ -181,9 +181,9 @@ il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta) ...@@ -181,9 +181,9 @@ il3945_rate_scale_flush_wins(struct il3945_rs_sta *rs_sta)
#define IL_AVERAGE_PACKETS 1500 #define IL_AVERAGE_PACKETS 1500
static void 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; struct il_priv *il __maybe_unused = rs_sta->il;
int unflushed = 0; int unflushed = 0;
unsigned long flags; unsigned long flags;
...@@ -360,9 +360,6 @@ il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id) ...@@ -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->flush_time = RATE_FLUSH;
rs_sta->last_tx_packets = 0; 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++) for (i = 0; i < RATE_COUNT_3945; i++)
il3945_clear_win(&rs_sta->win[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) ...@@ -415,8 +412,7 @@ il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t gfp)
rs_sta = &psta->rs_sta; rs_sta = &psta->rs_sta;
spin_lock_init(&rs_sta->lock); 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"); D_RATE("leave\n");
return rs_sta; return rs_sta;
......
...@@ -4074,9 +4074,9 @@ il4965_hdl_alive(struct il_priv *il, struct il_rx_buf *rxb) ...@@ -4074,9 +4074,9 @@ il4965_hdl_alive(struct il_priv *il, struct il_rx_buf *rxb)
* used for calibrating the TXPOWER. * used for calibrating the TXPOWER.
*/ */
static void 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)) if (test_bit(S_EXIT_PENDING, &il->status))
return; return;
...@@ -6258,10 +6258,9 @@ il4965_setup_deferred_work(struct il_priv *il) ...@@ -6258,10 +6258,9 @@ il4965_setup_deferred_work(struct il_priv *il)
INIT_WORK(&il->txpower_work, il4965_bg_txpower_work); INIT_WORK(&il->txpower_work, il4965_bg_txpower_work);
setup_timer(&il->stats_periodic, il4965_bg_stats_periodic, timer_setup(&il->stats_periodic, il4965_bg_stats_periodic, 0);
(unsigned long)il);
setup_timer(&il->watchdog, il_bg_watchdog, (unsigned long)il); timer_setup(&il->watchdog, il_bg_watchdog, 0);
tasklet_init(&il->irq_tasklet, tasklet_init(&il->irq_tasklet,
(void (*)(unsigned long))il4965_irq_tasklet, (void (*)(unsigned long))il4965_irq_tasklet,
......
...@@ -4844,9 +4844,9 @@ il_check_stuck_queue(struct il_priv *il, int cnt) ...@@ -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. * we reset the firmware. If everything is fine just rearm the timer.
*/ */
void 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; int cnt;
unsigned long timeout; unsigned long timeout;
......
...@@ -1832,7 +1832,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd); ...@@ -1832,7 +1832,7 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd);
* PCI * * 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); 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, __le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon,
u32 beacon_interval); u32 beacon_interval);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment