mutex_unlock(&ar->mutex);
 }
 
-static void ar5523_tx_wd_timer(unsigned long arg)
+static void ar5523_tx_wd_timer(struct timer_list *t)
 {
-       struct ar5523 *ar = (struct ar5523 *) arg;
+       struct ar5523 *ar = from_timer(ar, t, tx_wd_timer);
 
        ar5523_dbg(ar, "TX watchdog timer triggered\n");
        ieee80211_queue_work(ar->hw, &ar->tx_wd_work);
        mutex_init(&ar->mutex);
 
        INIT_DELAYED_WORK(&ar->stat_work, ar5523_stat_work);
-       init_timer(&ar->tx_wd_timer);
-       setup_timer(&ar->tx_wd_timer, ar5523_tx_wd_timer, (unsigned long) ar);
+       timer_setup(&ar->tx_wd_timer, ar5523_tx_wd_timer, 0);
        INIT_WORK(&ar->tx_wd_work, ar5523_tx_wd_work);
        INIT_WORK(&ar->tx_work, ar5523_tx_work);
        INIT_LIST_HEAD(&ar->tx_queue_pending);
 
        spin_unlock_bh(&htt->rx_ring.lock);
 }
 
-static void ath10k_htt_rx_ring_refill_retry(unsigned long arg)
+static void ath10k_htt_rx_ring_refill_retry(struct timer_list *t)
 {
-       struct ath10k_htt *htt = (struct ath10k_htt *)arg;
+       struct ath10k_htt *htt = from_timer(htt, t, rx_ring.refill_retry_timer);
 
        ath10k_htt_rx_msdu_buff_replenish(htt);
 }
        *htt->rx_ring.alloc_idx.vaddr = 0;
 
        /* Initialize the Rx refill retry timer */
-       setup_timer(timer, ath10k_htt_rx_ring_refill_retry, (unsigned long)htt);
+       timer_setup(timer, ath10k_htt_rx_ring_refill_retry, 0);
 
        spin_lock_init(&htt->rx_ring.lock);
 
 
        spin_unlock_irqrestore(&ar_pci->ps_lock, flags);
 }
 
-static void ath10k_pci_ps_timer(unsigned long ptr)
+static void ath10k_pci_ps_timer(struct timer_list *t)
 {
-       struct ath10k *ar = (void *)ptr;
-       struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+       struct ath10k_pci *ar_pci = from_timer(ar_pci, t, ps_timer);
+       struct ath10k *ar = ar_pci->ar;
        unsigned long flags;
 
        spin_lock_irqsave(&ar_pci->ps_lock, flags);
                ath10k_pci_rx_post_pipe(&ar_pci->pipe_info[i]);
 }
 
-void ath10k_pci_rx_replenish_retry(unsigned long ptr)
+void ath10k_pci_rx_replenish_retry(struct timer_list *t)
 {
-       struct ath10k *ar = (void *)ptr;
+       struct ath10k_pci *ar_pci = from_timer(ar_pci, t, rx_post_retry);
+       struct ath10k *ar = ar_pci->ar;
 
        ath10k_pci_rx_post(ar);
 }
        spin_lock_init(&ce->ce_lock);
        spin_lock_init(&ar_pci->ps_lock);
 
-       setup_timer(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry,
-                   (unsigned long)ar);
+       timer_setup(&ar_pci->rx_post_retry, ath10k_pci_rx_replenish_retry, 0);
 
        if (QCA_REV_6174(ar) || QCA_REV_9377(ar))
                ath10k_pci_override_ce_config(ar);
        ar->id.subsystem_vendor = pdev->subsystem_vendor;
        ar->id.subsystem_device = pdev->subsystem_device;
 
-       setup_timer(&ar_pci->ps_timer, ath10k_pci_ps_timer,
-                   (unsigned long)ar);
+       timer_setup(&ar_pci->ps_timer, ath10k_pci_ps_timer, 0);
 
        ret = ath10k_pci_setup_resource(ar);
        if (ret) {
 
 int ath10k_pci_alloc_pipes(struct ath10k *ar);
 void ath10k_pci_free_pipes(struct ath10k *ar);
 void ath10k_pci_free_pipes(struct ath10k *ar);
-void ath10k_pci_rx_replenish_retry(unsigned long ptr);
+void ath10k_pci_rx_replenish_retry(struct timer_list *t);
 void ath10k_pci_ce_deinit(struct ath10k *ar);
 void ath10k_pci_init_napi(struct ath10k *ar);
 int ath10k_pci_init_pipes(struct ath10k *ar);
 
                return -ENOMEM;
        }
 
-       setup_timer(&vif->disconnect_timer, disconnect_timer_handler,
-                   (unsigned long) vif->ndev);
-       setup_timer(&vif->sched_scan_timer, ath6kl_wmi_sscan_timer,
-                   (unsigned long) vif);
+       timer_setup(&vif->disconnect_timer, disconnect_timer_handler, 0);
+       timer_setup(&vif->sched_scan_timer, ath6kl_wmi_sscan_timer, 0);
 
        set_bit(WMM_ENABLED, &vif->flags);
        spin_lock_init(&vif->if_lock);
 
 
 int ath6kl_configure_target(struct ath6kl *ar);
 void ath6kl_detect_error(unsigned long ptr);
-void disconnect_timer_handler(unsigned long ptr);
+void disconnect_timer_handler(struct timer_list *t);
 void init_netdev(struct net_device *dev);
 void ath6kl_cookie_init(struct ath6kl *ar);
 void ath6kl_cookie_cleanup(struct ath6kl *ar);
 
        netif_wake_queue(vif->ndev);
 }
 
-void disconnect_timer_handler(unsigned long ptr)
+void disconnect_timer_handler(struct timer_list *t)
 {
-       struct net_device *dev = (struct net_device *)ptr;
-       struct ath6kl_vif *vif = netdev_priv(dev);
+       struct ath6kl_vif *vif = from_timer(vif, t, disconnect_timer);
 
        ath6kl_init_profile_info(vif);
        ath6kl_disconnect(vif);
 
        ath6kl_deliver_frames_to_nw_stack(vif->ndev, skb);
 }
 
-static void aggr_timeout(unsigned long arg)
+static void aggr_timeout(struct timer_list *t)
 {
        u8 i, j;
-       struct aggr_info_conn *aggr_conn = (struct aggr_info_conn *) arg;
+       struct aggr_info_conn *aggr_conn = from_timer(aggr_conn, t, timer);
        struct rxtid *rxtid;
        struct rxtid_stats *stats;
 
 
        aggr_conn->aggr_sz = AGGR_SZ_DEFAULT;
        aggr_conn->dev = vif->ndev;
-       setup_timer(&aggr_conn->timer, aggr_timeout, (unsigned long)aggr_conn);
+       timer_setup(&aggr_conn->timer, aggr_timeout, 0);
        aggr_conn->aggr_info = aggr_info;
 
        aggr_conn->timer_scheduled = false;
 
        return 0;
 }
 
-void ath6kl_wmi_sscan_timer(unsigned long ptr)
+void ath6kl_wmi_sscan_timer(struct timer_list *t)
 {
-       struct ath6kl_vif *vif = (struct ath6kl_vif *) ptr;
+       struct ath6kl_vif *vif = from_timer(vif, t, sched_scan_timer);
 
        cfg80211_sched_scan_results(vif->ar->wiphy, 0);
 }
 
 
 int ath6kl_wmi_set_inact_period(struct wmi *wmi, u8 if_idx, int inact_timeout);
 
-void ath6kl_wmi_sscan_timer(unsigned long ptr);
+void ath6kl_wmi_sscan_timer(struct timer_list *t);
 
 int ath6kl_wmi_get_challenge_resp_cmd(struct wmi *wmi, u32 cookie, u32 source);
 
 
 bool ath_hw_check(struct ath_softc *sc);
 void ath_hw_pll_work(struct work_struct *work);
 void ath_paprd_calibrate(struct work_struct *work);
-void ath_ani_calibrate(unsigned long data);
+void ath_ani_calibrate(struct timer_list *t);
 void ath_start_ani(struct ath_softc *sc);
 void ath_stop_ani(struct ath_softc *sc);
 void ath_check_ani(struct ath_softc *sc);
 int ath_update_survey_stats(struct ath_softc *sc);
 void ath_update_survey_nf(struct ath_softc *sc, int channel);
 void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type);
-void ath_ps_full_sleep(unsigned long data);
+void ath_ps_full_sleep(struct timer_list *t);
 void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop,
                   bool sw_pending, bool timeout_override);
 
 
        mod_timer(&sc->offchannel.timer, jiffies + sc->offchannel.duration);
 }
 
-static void ath_chanctx_timer(unsigned long data)
+static void ath_chanctx_timer(struct timer_list *t)
 {
-       struct ath_softc *sc = (struct ath_softc *) data;
+       struct ath_softc *sc = from_timer(sc, t, sched.timer);
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 
        ath_dbg(common, CHAN_CTX,
        ath_chanctx_event(sc, NULL, ATH_CHANCTX_EVENT_TSF_TIMER);
 }
 
-static void ath_offchannel_timer(unsigned long data)
+static void ath_offchannel_timer(struct timer_list *t)
 {
-       struct ath_softc *sc = (struct ath_softc *)data;
+       struct ath_softc *sc = from_timer(sc, t, offchannel.timer);
        struct ath_chanctx *ctx;
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 
 {
        INIT_WORK(&sc->chanctx_work, ath_chanctx_work);
 
-       setup_timer(&sc->offchannel.timer, ath_offchannel_timer,
-                   (unsigned long)sc);
-       setup_timer(&sc->sched.timer, ath_chanctx_timer,
-                   (unsigned long)sc);
+       timer_setup(&sc->offchannel.timer, ath_offchannel_timer, 0);
+       timer_setup(&sc->sched.timer, ath_chanctx_timer, 0);
 
        init_completion(&sc->go_beacon);
 }
 
  * 45ms, bt traffic will be given priority during 55% of this
  * period while wlan gets remaining 45%
  */
-static void ath_btcoex_period_timer(unsigned long data)
+static void ath_btcoex_period_timer(struct timer_list *t)
 {
-       struct ath_softc *sc = (struct ath_softc *) data;
+       struct ath_softc *sc = from_timer(sc, t, btcoex.period_timer);
        struct ath_hw *ah = sc->sc_ah;
        struct ath_btcoex *btcoex = &sc->btcoex;
        enum ath_stomp_type stomp_type;
  * Generic tsf based hw timer which configures weight
  * registers to time slice between wlan and bt traffic
  */
-static void ath_btcoex_no_stomp_timer(unsigned long arg)
+static void ath_btcoex_no_stomp_timer(struct timer_list *t)
 {
-       struct ath_softc *sc = (struct ath_softc *)arg;
+       struct ath_softc *sc = from_timer(sc, t, btcoex.no_stomp_timer);
        struct ath_hw *ah = sc->sc_ah;
        struct ath_btcoex *btcoex = &sc->btcoex;
 
                                   btcoex->btcoex_period / 100;
        btcoex->bt_stomp_type = ATH_BTCOEX_STOMP_LOW;
 
-       setup_timer(&btcoex->period_timer, ath_btcoex_period_timer,
-                       (unsigned long) sc);
-       setup_timer(&btcoex->no_stomp_timer, ath_btcoex_no_stomp_timer,
-                       (unsigned long) sc);
+       timer_setup(&btcoex->period_timer, ath_btcoex_period_timer, 0);
+       timer_setup(&btcoex->no_stomp_timer, ath_btcoex_no_stomp_timer, 0);
 
        spin_lock_init(&btcoex->btcoex_lock);
 }
 
 void ath9k_htc_tx_drain(struct ath9k_htc_priv *priv);
 void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event);
 void ath9k_tx_failed_tasklet(unsigned long data);
-void ath9k_htc_tx_cleanup_timer(unsigned long data);
+void ath9k_htc_tx_cleanup_timer(struct timer_list *t);
 bool ath9k_htc_csa_is_finished(struct ath9k_htc_priv *priv);
 
 int ath9k_rx_init(struct ath9k_htc_priv *priv);
 
        INIT_DELAYED_WORK(&priv->ani_work, ath9k_htc_ani_work);
        INIT_WORK(&priv->ps_work, ath9k_ps_work);
        INIT_WORK(&priv->fatal_work, ath9k_fatal_work);
-       setup_timer(&priv->tx.cleanup_timer, ath9k_htc_tx_cleanup_timer,
-                   (unsigned long)priv);
+       timer_setup(&priv->tx.cleanup_timer, ath9k_htc_tx_cleanup_timer, 0);
 
        /*
         * Cache line size is used to size and align various
 
        }
 }
 
-void ath9k_htc_tx_cleanup_timer(unsigned long data)
+void ath9k_htc_tx_cleanup_timer(struct timer_list *t)
 {
-       struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) data;
+       struct ath9k_htc_priv *priv = from_timer(priv, t, tx.cleanup_timer);
        struct ath_common *common = ath9k_hw_common(priv->ah);
        struct ath9k_htc_tx_event *event, *tmp;
        struct sk_buff *skb;
 
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
        int i = 0;
 
-       setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc);
+       timer_setup(&common->ani.timer, ath_ani_calibrate, 0);
 
        common->last_rssi = ATH_RSSI_DUMMY_MARKER;
        memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
        tasklet_init(&sc->bcon_tasklet, ath9k_beacon_tasklet,
                     (unsigned long)sc);
 
-       setup_timer(&sc->sleep_timer, ath_ps_full_sleep, (unsigned long)sc);
+       timer_setup(&sc->sleep_timer, ath_ps_full_sleep, 0);
        INIT_WORK(&sc->hw_reset_work, ath_reset_work);
        INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
        INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work);
 
  *  When the task is complete, it reschedules itself depending on the
  *  appropriate interval that was calculated.
  */
-void ath_ani_calibrate(unsigned long data)
+void ath_ani_calibrate(struct timer_list *t)
 {
-       struct ath_softc *sc = (struct ath_softc *)data;
+       struct ath_common *common = from_timer(common, t, ani.timer);
+       struct ath_softc *sc = (struct ath_softc *)common->priv;
        struct ath_hw *ah = sc->sc_ah;
-       struct ath_common *common = ath9k_hw_common(ah);
        bool longcal = false;
        bool shortcal = false;
        bool aniflag = false;
 
        return ret;
 }
 
-void ath_ps_full_sleep(unsigned long data)
+void ath_ps_full_sleep(struct timer_list *t)
 {
-       struct ath_softc *sc = (struct ath_softc *) data;
+       struct ath_softc *sc = from_timer(sc, t, sleep_timer);
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
        unsigned long flags;
        bool reset;
 
        clear_bit(wil_status_fwconnecting, wil->status);
 }
 
-static void wil_connect_timer_fn(ulong x)
+static void wil_connect_timer_fn(struct timer_list *t)
 {
-       struct wil6210_priv *wil = (void *)x;
+       struct wil6210_priv *wil = from_timer(wil, t, connect_timer);
        bool q;
 
        wil_err(wil, "Connect timeout detected, disconnect station\n");
        wil_dbg_wmi(wil, "queue_work of disconnect_worker -> %d\n", q);
 }
 
-static void wil_scan_timer_fn(ulong x)
+static void wil_scan_timer_fn(struct timer_list *t)
 {
-       struct wil6210_priv *wil = (void *)x;
+       struct wil6210_priv *wil = from_timer(wil, t, scan_timer);
 
        clear_bit(wil_status_fwready, wil->status);
        wil_err(wil, "Scan timeout detected, start fw error recovery\n");
        init_completion(&wil->halp.comp);
 
        wil->bcast_vring = -1;
-       setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil);
-       setup_timer(&wil->scan_timer, wil_scan_timer_fn, (ulong)wil);
-       setup_timer(&wil->p2p.discovery_timer, wil_p2p_discovery_timer_fn,
-                   (ulong)wil);
+       timer_setup(&wil->connect_timer, wil_connect_timer_fn, 0);
+       timer_setup(&wil->scan_timer, wil_scan_timer_fn, 0);
+       timer_setup(&wil->p2p.discovery_timer, wil_p2p_discovery_timer_fn, 0);
 
        INIT_WORK(&wil->disconnect_worker, wil_disconnect_worker);
        INIT_WORK(&wil->wmi_event_worker, wmi_event_worker);
 
               (request->channels[0]->hw_value == P2P_DMG_SOCIAL_CHANNEL);
 }
 
-void wil_p2p_discovery_timer_fn(ulong x)
+void wil_p2p_discovery_timer_fn(struct timer_list *t)
 {
-       struct wil6210_priv *wil = (void *)x;
+       struct wil6210_priv *wil = from_timer(wil, t, p2p.discovery_timer);
 
        wil_dbg_misc(wil, "p2p_discovery_timer_fn\n");
 
 
 
 /* P2P */
 bool wil_p2p_is_social_scan(struct cfg80211_scan_request *request);
-void wil_p2p_discovery_timer_fn(ulong x);
+void wil_p2p_discovery_timer_fn(struct timer_list *t);
 int wil_p2p_search(struct wil6210_priv *wil,
                   struct cfg80211_scan_request *request);
 int wil_p2p_listen(struct wil6210_priv *wil, struct wireless_dev *wdev,