wifi: rtw89: use wiphy_work() to replace ieee802111_work()
authorPing-Ke Shih <pkshih@realtek.com>
Wed, 22 Jan 2025 06:03:02 +0000 (14:03 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Mon, 3 Feb 2025 02:23:05 +0000 (10:23 +0800)
For certain works protected by driver mutex, use wiphy_work() directly
to have wiphy lock held naturally. Then every this kind of works is
protected by both wiphy lock and driver mutex.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250122060310.31976-3-pkshih@realtek.com
12 files changed:
drivers/net/wireless/realtek/rtw89/chan.c
drivers/net/wireless/realtek/rtw89/chan.h
drivers/net/wireless/realtek/rtw89/coex.c
drivers/net/wireless/realtek/rtw89/coex.h
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/fw.h
drivers/net/wireless/realtek/rtw89/mac80211.c
drivers/net/wireless/realtek/rtw89/phy.c
drivers/net/wireless/realtek/rtw89/phy.h
drivers/net/wireless/realtek/rtw89/ser.c

index 4df4e04c3e67d7fe99d30a20ccea0a32a8b20fe6..9858894dfc236238bd92937bdb38351c94249c37 100644 (file)
@@ -2390,7 +2390,7 @@ static void rtw89_mcc_update_limit(struct rtw89_dev *rtwdev)
        rtw89_iterate_mcc_roles(rtwdev, rtw89_mcc_upd_lmt_iterator, NULL);
 }
 
-void rtw89_chanctx_work(struct work_struct *work)
+void rtw89_chanctx_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                chanctx_work.work);
@@ -2477,8 +2477,8 @@ void rtw89_queue_chanctx_change(struct rtw89_dev *rtwdev,
        rtw89_debug(rtwdev, RTW89_DBG_CHAN,
                    "queue chanctx work for mode %d with delay %d us\n",
                    mode, delay);
-       ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->chanctx_work,
-                                    usecs_to_jiffies(delay));
+       wiphy_delayed_work_queue(rtwdev->hw->wiphy, &rtwdev->chanctx_work,
+                                usecs_to_jiffies(delay));
 }
 
 void rtw89_queue_chanctx_work(struct rtw89_dev *rtwdev)
index 092a6f676894f55a73c10f3c7e306ba8ce408b49..e6391f6f2aa78d1e7d9974f61d05f21c6fa2528e 100644 (file)
@@ -99,7 +99,7 @@ void rtw89_config_roc_chandef(struct rtw89_dev *rtwdev,
                              const struct cfg80211_chan_def *chandef);
 void rtw89_entity_init(struct rtw89_dev *rtwdev);
 enum rtw89_entity_mode rtw89_entity_recalc(struct rtw89_dev *rtwdev);
-void rtw89_chanctx_work(struct work_struct *work);
+void rtw89_chanctx_work(struct wiphy *wiphy, struct wiphy_work *work);
 void rtw89_queue_chanctx_work(struct rtw89_dev *rtwdev);
 void rtw89_queue_chanctx_change(struct rtw89_dev *rtwdev,
                                enum rtw89_chanctx_changes change);
index 755c157c815d4d9e84a6d3f722ea623e87573991..c51c0690996662eb03b63e71206922bdbefb108c 100644 (file)
@@ -6712,7 +6712,7 @@ static void _update_wl_info_v8(struct rtw89_dev *rtwdev, u8 role_id, u8 rlink_id
        _fw_set_drv_info(rtwdev, CXDRVINFO_ROLE);
 }
 
-void rtw89_coex_act1_work(struct work_struct *work)
+void rtw89_coex_act1_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                coex_act1_work.work);
@@ -6733,7 +6733,7 @@ void rtw89_coex_act1_work(struct work_struct *work)
        mutex_unlock(&rtwdev->mutex);
 }
 
-void rtw89_coex_bt_devinfo_work(struct work_struct *work)
+void rtw89_coex_bt_devinfo_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                coex_bt_devinfo_work.work);
@@ -6749,7 +6749,7 @@ void rtw89_coex_bt_devinfo_work(struct work_struct *work)
        mutex_unlock(&rtwdev->mutex);
 }
 
-void rtw89_coex_rfk_chk_work(struct work_struct *work)
+void rtw89_coex_rfk_chk_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                coex_rfk_chk_work.work);
@@ -7278,7 +7278,7 @@ void rtw89_btc_ntfy_specific_packet(struct rtw89_dev *rtwdev,
                            "[BTC], %s(): EAPOL_End cnt=%d\n",
                            __func__, cnt);
                wl->status.map._4way = false;
-               cancel_delayed_work(&rtwdev->coex_act1_work);
+               wiphy_delayed_work_cancel(rtwdev->hw->wiphy, &rtwdev->coex_act1_work);
                break;
        case PACKET_ARP:
                cnt = ++cx->cnt_wl[BTC_WCNT_ARP];
@@ -7297,16 +7297,16 @@ void rtw89_btc_ntfy_specific_packet(struct rtw89_dev *rtwdev,
        }
 
        if (delay_work) {
-               cancel_delayed_work(&rtwdev->coex_act1_work);
-               ieee80211_queue_delayed_work(rtwdev->hw,
-                                            &rtwdev->coex_act1_work, delay);
+               wiphy_delayed_work_cancel(rtwdev->hw->wiphy, &rtwdev->coex_act1_work);
+               wiphy_delayed_work_queue(rtwdev->hw->wiphy,
+                                        &rtwdev->coex_act1_work, delay);
        }
 
        btc->dm.cnt_notify[BTC_NCNT_SPECIAL_PACKET]++;
        _run_coex(rtwdev, BTC_RSN_NTFY_SPECIFIC_PACKET);
 }
 
-void rtw89_btc_ntfy_eapol_packet_work(struct work_struct *work)
+void rtw89_btc_ntfy_eapol_packet_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                btc.eapol_notify_work);
@@ -7317,7 +7317,7 @@ void rtw89_btc_ntfy_eapol_packet_work(struct work_struct *work)
        mutex_unlock(&rtwdev->mutex);
 }
 
-void rtw89_btc_ntfy_arp_packet_work(struct work_struct *work)
+void rtw89_btc_ntfy_arp_packet_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                btc.arp_notify_work);
@@ -7327,7 +7327,7 @@ void rtw89_btc_ntfy_arp_packet_work(struct work_struct *work)
        mutex_unlock(&rtwdev->mutex);
 }
 
-void rtw89_btc_ntfy_dhcp_packet_work(struct work_struct *work)
+void rtw89_btc_ntfy_dhcp_packet_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                btc.dhcp_notify_work);
@@ -7338,7 +7338,7 @@ void rtw89_btc_ntfy_dhcp_packet_work(struct work_struct *work)
        mutex_unlock(&rtwdev->mutex);
 }
 
-void rtw89_btc_ntfy_icmp_packet_work(struct work_struct *work)
+void rtw89_btc_ntfy_icmp_packet_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                btc.icmp_notify_work);
@@ -7525,9 +7525,9 @@ static void _update_bt_info(struct rtw89_dev *rtwdev, u8 *buf, u32 len)
                a2dp->vendor_id = 0;
                a2dp->flush_time = 0;
                a2dp->play_latency = 1;
-               ieee80211_queue_delayed_work(rtwdev->hw,
-                                            &rtwdev->coex_bt_devinfo_work,
-                                            RTW89_COEX_BT_DEVINFO_WORK_PERIOD);
+               wiphy_delayed_work_queue(rtwdev->hw->wiphy,
+                                        &rtwdev->coex_bt_devinfo_work,
+                                        RTW89_COEX_BT_DEVINFO_WORK_PERIOD);
        }
 
        _run_coex(rtwdev, BTC_RSN_UPDATE_BT_INFO);
@@ -7776,7 +7776,7 @@ static bool _ntfy_wl_rfk(struct rtw89_dev *rtwdev, u8 phy_path,
                wl->rfk_info.state = BTC_WRFK_STOP;
 
                _write_scbd(rtwdev, BTC_WSCB_WLRFK, false);
-               cancel_delayed_work(&rtwdev->coex_rfk_chk_work);
+               wiphy_delayed_work_cancel(rtwdev->hw->wiphy, &rtwdev->coex_rfk_chk_work);
                break;
        default:
                rtw89_debug(rtwdev, RTW89_DBG_BTC,
@@ -7790,9 +7790,9 @@ static bool _ntfy_wl_rfk(struct rtw89_dev *rtwdev, u8 phy_path,
                        _run_coex(rtwdev, BTC_RSN_NTFY_WL_RFK);
 
                if (wl->rfk_info.state == BTC_WRFK_START)
-                       ieee80211_queue_delayed_work(rtwdev->hw,
-                                                    &rtwdev->coex_rfk_chk_work,
-                                                    RTW89_COEX_RFK_CHK_WORK_PERIOD);
+                       wiphy_delayed_work_queue(rtwdev->hw->wiphy,
+                                                &rtwdev->coex_rfk_chk_work,
+                                                RTW89_COEX_RFK_CHK_WORK_PERIOD);
        }
 
        rtw89_debug(rtwdev, RTW89_DBG_BTC,
@@ -7810,6 +7810,8 @@ void rtw89_btc_ntfy_wl_rfk(struct rtw89_dev *rtwdev, u8 phy_map,
        bool allow;
        int ret;
 
+       lockdep_assert_wiphy(rtwdev->hw->wiphy);
+
        band = FIELD_GET(BTC_RFK_BAND_MAP, phy_map);
 
        rtw89_debug(rtwdev, RTW89_DBG_RFK,
index 757d03675cf4e67e266480253783c3dbe276726c..30134f58d5317a1b8c65237ab63b24548f76bc26 100644 (file)
@@ -267,10 +267,10 @@ void rtw89_btc_ntfy_scan_finish(struct rtw89_dev *rtwdev, u8 phy_idx);
 void rtw89_btc_ntfy_switch_band(struct rtw89_dev *rtwdev, u8 phy_idx, u8 band);
 void rtw89_btc_ntfy_specific_packet(struct rtw89_dev *rtwdev,
                                    enum btc_pkt_type pkt_type);
-void rtw89_btc_ntfy_eapol_packet_work(struct work_struct *work);
-void rtw89_btc_ntfy_arp_packet_work(struct work_struct *work);
-void rtw89_btc_ntfy_dhcp_packet_work(struct work_struct *work);
-void rtw89_btc_ntfy_icmp_packet_work(struct work_struct *work);
+void rtw89_btc_ntfy_eapol_packet_work(struct wiphy *wiphy, struct wiphy_work *work);
+void rtw89_btc_ntfy_arp_packet_work(struct wiphy *wiphy, struct wiphy_work *work);
+void rtw89_btc_ntfy_dhcp_packet_work(struct wiphy *wiphy, struct wiphy_work *work);
+void rtw89_btc_ntfy_icmp_packet_work(struct wiphy *wiphy, struct wiphy_work *work);
 void rtw89_btc_ntfy_role_info(struct rtw89_dev *rtwdev,
                              struct rtw89_vif_link *rtwvif_link,
                              struct rtw89_sta_link *rtwsta_link,
@@ -283,9 +283,9 @@ void rtw89_btc_ntfy_wl_sta(struct rtw89_dev *rtwdev);
 void rtw89_btc_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
                          u32 len, u8 class, u8 func);
 void rtw89_btc_dump_info(struct rtw89_dev *rtwdev, struct seq_file *m);
-void rtw89_coex_act1_work(struct work_struct *work);
-void rtw89_coex_bt_devinfo_work(struct work_struct *work);
-void rtw89_coex_rfk_chk_work(struct work_struct *work);
+void rtw89_coex_act1_work(struct wiphy *wiphy, struct wiphy_work *work);
+void rtw89_coex_bt_devinfo_work(struct wiphy *wiphy, struct wiphy_work *work);
+void rtw89_coex_rfk_chk_work(struct wiphy *wiphy, struct wiphy_work *work);
 void rtw89_coex_power_on(struct rtw89_dev *rtwdev);
 void rtw89_btc_set_policy(struct rtw89_dev *rtwdev, u16 policy_type);
 void rtw89_btc_set_policy_v1(struct rtw89_dev *rtwdev, u16 policy_type);
index 37002cfe832594f1b1e6f99e16b935033949f4d6..330b23db4868bd269f02bf684a9e78ed3ac53a15 100644 (file)
@@ -913,16 +913,17 @@ static enum btc_pkt_type
 rtw89_core_tx_btc_spec_pkt_notify(struct rtw89_dev *rtwdev,
                                  struct rtw89_core_tx_request *tx_req)
 {
+       struct wiphy *wiphy = rtwdev->hw->wiphy;
        struct sk_buff *skb = tx_req->skb;
        struct udphdr *udphdr;
 
        if (IEEE80211_SKB_CB(skb)->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO) {
-               ieee80211_queue_work(rtwdev->hw, &rtwdev->btc.eapol_notify_work);
+               wiphy_work_queue(wiphy, &rtwdev->btc.eapol_notify_work);
                return PACKET_EAPOL;
        }
 
        if (skb->protocol == htons(ETH_P_ARP)) {
-               ieee80211_queue_work(rtwdev->hw, &rtwdev->btc.arp_notify_work);
+               wiphy_work_queue(wiphy, &rtwdev->btc.arp_notify_work);
                return PACKET_ARP;
        }
 
@@ -932,14 +933,14 @@ rtw89_core_tx_btc_spec_pkt_notify(struct rtw89_dev *rtwdev,
                if (((udphdr->source == htons(67) && udphdr->dest == htons(68)) ||
                     (udphdr->source == htons(68) && udphdr->dest == htons(67))) &&
                    skb->len > 282) {
-                       ieee80211_queue_work(rtwdev->hw, &rtwdev->btc.dhcp_notify_work);
+                       wiphy_work_queue(wiphy, &rtwdev->btc.dhcp_notify_work);
                        return PACKET_DHCP;
                }
        }
 
        if (skb->protocol == htons(ETH_P_IP) &&
            ip_hdr(skb)->protocol == IPPROTO_ICMP) {
-               ieee80211_queue_work(rtwdev->hw, &rtwdev->btc.icmp_notify_work);
+               wiphy_work_queue(wiphy, &rtwdev->btc.icmp_notify_work);
                return PACKET_ICMP;
        }
 
@@ -2071,7 +2072,7 @@ static void rtw89_stats_trigger_frame(struct rtw89_dev *rtwdev,
        }
 }
 
-static void rtw89_cancel_6ghz_probe_work(struct work_struct *work)
+static void rtw89_cancel_6ghz_probe_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                cancel_6ghz_probe_work);
@@ -2131,7 +2132,7 @@ static void rtw89_core_cancel_6ghz_probe_tx(struct rtw89_dev *rtwdev,
        }
 
        if (queue_work)
-               ieee80211_queue_work(rtwdev->hw, &rtwdev->cancel_6ghz_probe_work);
+               wiphy_work_queue(rtwdev->hw->wiphy, &rtwdev->cancel_6ghz_probe_work);
 }
 
 static void rtw89_vif_sync_bcn_tsf(struct rtw89_vif_link *rtwvif_link,
@@ -3143,7 +3144,7 @@ static void rtw89_core_txq_schedule(struct rtw89_dev *rtwdev, u8 ac, bool *reinv
        ieee80211_txq_schedule_end(hw, ac);
 }
 
-static void rtw89_ips_work(struct work_struct *work)
+static void rtw89_ips_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                ips_work);
@@ -3330,9 +3331,9 @@ void rtw89_roc_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
        rtw89_write32_clr(rtwdev, reg, B_AX_A_UC_CAM_MATCH | B_AX_A_BC_CAM_MATCH);
 
        ieee80211_ready_on_channel(hw);
-       cancel_delayed_work(&rtwvif->roc.roc_work);
-       ieee80211_queue_delayed_work(hw, &rtwvif->roc.roc_work,
-                                    msecs_to_jiffies(rtwvif->roc.duration));
+       wiphy_delayed_work_cancel(hw->wiphy, &rtwvif->roc.roc_work);
+       wiphy_delayed_work_queue(hw->wiphy, &rtwvif->roc.roc_work,
+                                msecs_to_jiffies(rtwvif->roc.duration));
 }
 
 void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
@@ -3377,11 +3378,11 @@ void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
        queue_work(rtwdev->txq_wq, &rtwdev->txq_work);
 
        if (hw->conf.flags & IEEE80211_CONF_IDLE)
-               ieee80211_queue_delayed_work(hw, &roc->roc_work,
-                                            msecs_to_jiffies(RTW89_ROC_IDLE_TIMEOUT));
+               wiphy_delayed_work_queue(hw->wiphy, &roc->roc_work,
+                                        msecs_to_jiffies(RTW89_ROC_IDLE_TIMEOUT));
 }
 
-void rtw89_roc_work(struct work_struct *work)
+void rtw89_roc_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_vif *rtwvif = container_of(work, struct rtw89_vif,
                                                roc.roc_work.work);
@@ -3533,7 +3534,7 @@ void rtw89_traffic_stats_init(struct rtw89_dev *rtwdev,
        ewma_tp_init(&stats->rx_ewma_tp);
 }
 
-static void rtw89_track_work(struct work_struct *work)
+static void rtw89_track_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                track_work.work);
@@ -3547,8 +3548,8 @@ static void rtw89_track_work(struct work_struct *work)
        if (!test_bit(RTW89_FLAG_RUNNING, rtwdev->flags))
                goto out;
 
-       ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->track_work,
-                                    RTW89_TRACK_WORK_PERIOD);
+       wiphy_delayed_work_queue(wiphy, &rtwdev->track_work,
+                                RTW89_TRACK_WORK_PERIOD);
 
        tfc_changed = rtw89_traffic_stats_track(rtwdev);
        if (rtwdev->scanning)
@@ -4438,7 +4439,7 @@ static void rtw89_core_ppdu_sts_init(struct rtw89_dev *rtwdev)
                rtwdev->ppdu_sts.curr_rx_ppdu_cnt[i] = U8_MAX;
 }
 
-void rtw89_core_update_beacon_work(struct work_struct *work)
+void rtw89_core_update_beacon_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev;
        struct rtw89_vif_link *rtwvif_link = container_of(work, struct rtw89_vif_link,
@@ -4568,8 +4569,8 @@ int rtw89_core_start(struct rtw89_dev *rtwdev)
                return ret;
        }
 
-       ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->track_work,
-                                    RTW89_TRACK_WORK_PERIOD);
+       wiphy_delayed_work_queue(rtwdev->hw->wiphy, &rtwdev->track_work,
+                                RTW89_TRACK_WORK_PERIOD);
 
        set_bit(RTW89_FLAG_RUNNING, rtwdev->flags);
 
@@ -4583,6 +4584,7 @@ int rtw89_core_start(struct rtw89_dev *rtwdev)
 
 void rtw89_core_stop(struct rtw89_dev *rtwdev)
 {
+       struct wiphy *wiphy = rtwdev->hw->wiphy;
        struct rtw89_btc *btc = &rtwdev->btc;
 
        /* Prvent to stop twice; enter_ips and ops_stop */
@@ -4595,21 +4597,21 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev)
 
        mutex_unlock(&rtwdev->mutex);
 
-       cancel_work_sync(&rtwdev->c2h_work);
-       cancel_work_sync(&rtwdev->cancel_6ghz_probe_work);
-       cancel_work_sync(&btc->eapol_notify_work);
-       cancel_work_sync(&btc->arp_notify_work);
-       cancel_work_sync(&btc->dhcp_notify_work);
-       cancel_work_sync(&btc->icmp_notify_work);
+       wiphy_work_cancel(wiphy, &rtwdev->c2h_work);
+       wiphy_work_cancel(wiphy, &rtwdev->cancel_6ghz_probe_work);
+       wiphy_work_cancel(wiphy, &btc->eapol_notify_work);
+       wiphy_work_cancel(wiphy, &btc->arp_notify_work);
+       wiphy_work_cancel(wiphy, &btc->dhcp_notify_work);
+       wiphy_work_cancel(wiphy, &btc->icmp_notify_work);
        cancel_delayed_work_sync(&rtwdev->txq_reinvoke_work);
-       cancel_delayed_work_sync(&rtwdev->track_work);
-       cancel_delayed_work_sync(&rtwdev->chanctx_work);
-       cancel_delayed_work_sync(&rtwdev->coex_act1_work);
-       cancel_delayed_work_sync(&rtwdev->coex_bt_devinfo_work);
-       cancel_delayed_work_sync(&rtwdev->coex_rfk_chk_work);
-       cancel_delayed_work_sync(&rtwdev->cfo_track_work);
+       wiphy_delayed_work_cancel(wiphy, &rtwdev->track_work);
+       wiphy_delayed_work_cancel(wiphy, &rtwdev->chanctx_work);
+       wiphy_delayed_work_cancel(wiphy, &rtwdev->coex_act1_work);
+       wiphy_delayed_work_cancel(wiphy, &rtwdev->coex_bt_devinfo_work);
+       wiphy_delayed_work_cancel(wiphy, &rtwdev->coex_rfk_chk_work);
+       wiphy_delayed_work_cancel(wiphy, &rtwdev->cfo_track_work);
        cancel_delayed_work_sync(&rtwdev->forbid_ba_work);
-       cancel_delayed_work_sync(&rtwdev->antdiv_work);
+       wiphy_delayed_work_cancel(wiphy, &rtwdev->antdiv_work);
 
        mutex_lock(&rtwdev->mutex);
 
@@ -4825,14 +4827,14 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
        INIT_WORK(&rtwdev->ba_work, rtw89_core_ba_work);
        INIT_WORK(&rtwdev->txq_work, rtw89_core_txq_work);
        INIT_DELAYED_WORK(&rtwdev->txq_reinvoke_work, rtw89_core_txq_reinvoke_work);
-       INIT_DELAYED_WORK(&rtwdev->track_work, rtw89_track_work);
-       INIT_DELAYED_WORK(&rtwdev->chanctx_work, rtw89_chanctx_work);
-       INIT_DELAYED_WORK(&rtwdev->coex_act1_work, rtw89_coex_act1_work);
-       INIT_DELAYED_WORK(&rtwdev->coex_bt_devinfo_work, rtw89_coex_bt_devinfo_work);
-       INIT_DELAYED_WORK(&rtwdev->coex_rfk_chk_work, rtw89_coex_rfk_chk_work);
-       INIT_DELAYED_WORK(&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work);
+       wiphy_delayed_work_init(&rtwdev->track_work, rtw89_track_work);
+       wiphy_delayed_work_init(&rtwdev->chanctx_work, rtw89_chanctx_work);
+       wiphy_delayed_work_init(&rtwdev->coex_act1_work, rtw89_coex_act1_work);
+       wiphy_delayed_work_init(&rtwdev->coex_bt_devinfo_work, rtw89_coex_bt_devinfo_work);
+       wiphy_delayed_work_init(&rtwdev->coex_rfk_chk_work, rtw89_coex_rfk_chk_work);
+       wiphy_delayed_work_init(&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work);
        INIT_DELAYED_WORK(&rtwdev->forbid_ba_work, rtw89_forbid_ba_work);
-       INIT_DELAYED_WORK(&rtwdev->antdiv_work, rtw89_phy_antdiv_work);
+       wiphy_delayed_work_init(&rtwdev->antdiv_work, rtw89_phy_antdiv_work);
        rtwdev->txq_wq = alloc_workqueue("rtw89_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
        if (!rtwdev->txq_wq)
                return -ENOMEM;
@@ -4847,10 +4849,10 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
        rtw89_init_wait(&rtwdev->wow.wait);
        rtw89_init_wait(&rtwdev->mac.ps_wait);
 
-       INIT_WORK(&rtwdev->c2h_work, rtw89_fw_c2h_work);
-       INIT_WORK(&rtwdev->ips_work, rtw89_ips_work);
+       wiphy_work_init(&rtwdev->c2h_work, rtw89_fw_c2h_work);
+       wiphy_work_init(&rtwdev->ips_work, rtw89_ips_work);
+       wiphy_work_init(&rtwdev->cancel_6ghz_probe_work, rtw89_cancel_6ghz_probe_work);
        INIT_WORK(&rtwdev->load_firmware_work, rtw89_load_firmware_work);
-       INIT_WORK(&rtwdev->cancel_6ghz_probe_work, rtw89_cancel_6ghz_probe_work);
 
        skb_queue_head_init(&rtwdev->c2h_queue);
        rtw89_core_ppdu_sts_init(rtwdev);
@@ -4870,10 +4872,10 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
        rtwdev->bbs[RTW89_PHY_0].phy_idx = RTW89_PHY_0;
        rtwdev->bbs[RTW89_PHY_1].phy_idx = RTW89_PHY_1;
 
-       INIT_WORK(&btc->eapol_notify_work, rtw89_btc_ntfy_eapol_packet_work);
-       INIT_WORK(&btc->arp_notify_work, rtw89_btc_ntfy_arp_packet_work);
-       INIT_WORK(&btc->dhcp_notify_work, rtw89_btc_ntfy_dhcp_packet_work);
-       INIT_WORK(&btc->icmp_notify_work, rtw89_btc_ntfy_icmp_packet_work);
+       wiphy_work_init(&btc->eapol_notify_work, rtw89_btc_ntfy_eapol_packet_work);
+       wiphy_work_init(&btc->arp_notify_work, rtw89_btc_ntfy_arp_packet_work);
+       wiphy_work_init(&btc->dhcp_notify_work, rtw89_btc_ntfy_dhcp_packet_work);
+       wiphy_work_init(&btc->icmp_notify_work, rtw89_btc_ntfy_icmp_packet_work);
 
        init_completion(&rtwdev->fw.req.completion);
        init_completion(&rtwdev->rfk_wait.completion);
@@ -4949,7 +4951,7 @@ void rtw89_core_scan_complete(struct rtw89_dev *rtwdev,
        rtw89_for_each_active_bb(rtwdev, bb)
                bb->dig.bypass_dig = true;
        if (hw_scan && (rtwdev->hw->conf.flags & IEEE80211_CONF_IDLE))
-               ieee80211_queue_work(rtwdev->hw, &rtwdev->ips_work);
+               wiphy_work_queue(rtwdev->hw->wiphy, &rtwdev->ips_work);
 }
 
 static void rtw89_read_chip_ver(struct rtw89_dev *rtwdev)
index 9a44475a8be6444bafb6937207570d88e961568e..6970e4d4e73faefb04abd496e535147eb7e0b646 100644 (file)
@@ -3177,10 +3177,10 @@ struct rtw89_btc {
        struct rtw89_btc_btf_fwinfo fwinfo;
        struct rtw89_btc_dbg dbg;
 
-       struct work_struct eapol_notify_work;
-       struct work_struct arp_notify_work;
-       struct work_struct dhcp_notify_work;
-       struct work_struct icmp_notify_work;
+       struct wiphy_work eapol_notify_work;
+       struct wiphy_work arp_notify_work;
+       struct wiphy_work dhcp_notify_work;
+       struct wiphy_work icmp_notify_work;
 
        u32 bt_req_len;
 
@@ -3447,7 +3447,7 @@ enum rtw89_roc_state {
 
 struct rtw89_roc {
        struct ieee80211_channel chan;
-       struct delayed_work roc_work;
+       struct wiphy_delayed_work roc_work;
        enum ieee80211_roc_type type;
        enum rtw89_roc_state state;
        int duration;
@@ -3517,7 +3517,7 @@ struct rtw89_vif_link {
        bool pre_pwr_diff_en;
        bool pwr_diff_en;
        u8 def_tri_idx;
-       struct work_struct update_beacon_work;
+       struct wiphy_work update_beacon_work;
        struct rtw89_addr_cam_entry addr_cam;
        struct rtw89_bssid_cam_entry bssid_cam;
        struct ieee80211_tx_queue_params tx_params[IEEE80211_NUM_ACS];
@@ -5674,10 +5674,10 @@ struct rtw89_dev {
        struct rtw89_cam_info cam_info;
 
        struct sk_buff_head c2h_queue;
-       struct work_struct c2h_work;
-       struct work_struct ips_work;
+       struct wiphy_work c2h_work;
+       struct wiphy_work ips_work;
+       struct wiphy_work cancel_6ghz_probe_work;
        struct work_struct load_firmware_work;
-       struct work_struct cancel_6ghz_probe_work;
 
        struct list_head early_h2c_list;
 
@@ -5722,14 +5722,14 @@ struct rtw89_dev {
                struct rtw89_edcca_bak edcca_bak;
        } bbs[RTW89_PHY_NUM];
 
-       struct delayed_work track_work;
-       struct delayed_work chanctx_work;
-       struct delayed_work coex_act1_work;
-       struct delayed_work coex_bt_devinfo_work;
-       struct delayed_work coex_rfk_chk_work;
-       struct delayed_work cfo_track_work;
+       struct wiphy_delayed_work track_work;
+       struct wiphy_delayed_work chanctx_work;
+       struct wiphy_delayed_work coex_act1_work;
+       struct wiphy_delayed_work coex_bt_devinfo_work;
+       struct wiphy_delayed_work coex_rfk_chk_work;
+       struct wiphy_delayed_work cfo_track_work;
        struct delayed_work forbid_ba_work;
-       struct delayed_work antdiv_work;
+       struct wiphy_delayed_work antdiv_work;
        struct rtw89_ppdu_sts_info ppdu_sts;
        u8 total_sta_assoc;
        bool scanning;
@@ -7170,8 +7170,8 @@ void rtw89_complete_cond(struct rtw89_wait_info *wait, unsigned int cond,
                         const struct rtw89_completion_data *data);
 int rtw89_core_start(struct rtw89_dev *rtwdev);
 void rtw89_core_stop(struct rtw89_dev *rtwdev);
-void rtw89_core_update_beacon_work(struct work_struct *work);
-void rtw89_roc_work(struct work_struct *work);
+void rtw89_core_update_beacon_work(struct wiphy *wiphy, struct wiphy_work *work);
+void rtw89_roc_work(struct wiphy *wiphy, struct wiphy_work *work);
 void rtw89_roc_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
 void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
 void rtw89_core_scan_start(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link,
index cb5ccd9df364e02138f792b3077a8a9122d5a9e8..64c2895309c6e4b4a00a404d46ff29b167c9f6e4 100644 (file)
@@ -6157,7 +6157,7 @@ void rtw89_fw_c2h_irqsafe(struct rtw89_dev *rtwdev, struct sk_buff *c2h)
 
 enqueue:
        skb_queue_tail(&rtwdev->c2h_queue, c2h);
-       ieee80211_queue_work(rtwdev->hw, &rtwdev->c2h_work);
+       wiphy_work_queue(rtwdev->hw->wiphy, &rtwdev->c2h_work);
 }
 
 static void rtw89_fw_c2h_cmd_handle(struct rtw89_dev *rtwdev,
@@ -6195,7 +6195,7 @@ static void rtw89_fw_c2h_cmd_handle(struct rtw89_dev *rtwdev,
                rtw89_hex_dump(rtwdev, RTW89_DBG_FW, "C2H: ", skb->data, skb->len);
 }
 
-void rtw89_fw_c2h_work(struct work_struct *work)
+void rtw89_fw_c2h_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                c2h_work);
index c8faa2f29f5e8cc97d4e7cc082501bcc82347113..b621dbed2c615cc0f3fe4210fbe365a5e66c172f 100644 (file)
@@ -4599,7 +4599,7 @@ int rtw89_fw_h2c_dctl_sec_cam_v2(struct rtw89_dev *rtwdev,
                                 struct rtw89_vif_link *rtwvif_link,
                                 struct rtw89_sta_link *rtwsta_link);
 void rtw89_fw_c2h_irqsafe(struct rtw89_dev *rtwdev, struct sk_buff *c2h);
-void rtw89_fw_c2h_work(struct work_struct *work);
+void rtw89_fw_c2h_work(struct wiphy *wiphy, struct wiphy_work *work);
 int rtw89_fw_h2c_role_maintain(struct rtw89_dev *rtwdev,
                               struct rtw89_vif_link *rtwvif_link,
                               struct rtw89_sta_link *rtwsta_link,
index b3669e0074df9d45de0de5eebd30ff678f1eafb6..7b3520e6389bb379cb209101d6b30528308afbf9 100644 (file)
@@ -80,7 +80,7 @@ static int rtw89_ops_config(struct ieee80211_hw *hw, u32 changed)
        struct rtw89_dev *rtwdev = hw->priv;
 
        /* let previous ips work finish to ensure we don't leave ips twice */
-       cancel_work_sync(&rtwdev->ips_work);
+       wiphy_work_cancel(hw->wiphy, &rtwdev->ips_work);
 
        mutex_lock(&rtwdev->mutex);
        rtw89_leave_ps_mode(rtwdev);
@@ -115,7 +115,7 @@ static int __rtw89_ops_add_iface_link(struct rtw89_dev *rtwdev,
 
        rtw89_vif_type_mapping(rtwvif_link, false);
 
-       INIT_WORK(&rtwvif_link->update_beacon_work, rtw89_core_update_beacon_work);
+       wiphy_work_init(&rtwvif_link->update_beacon_work, rtw89_core_update_beacon_work);
        INIT_LIST_HEAD(&rtwvif_link->general_pkt_list);
 
        rtwvif_link->hit_rule = 0;
@@ -143,7 +143,7 @@ static void __rtw89_ops_remove_iface_link(struct rtw89_dev *rtwdev,
                                          struct rtw89_vif_link *rtwvif_link)
 {
        mutex_unlock(&rtwdev->mutex);
-       cancel_work_sync(&rtwvif_link->update_beacon_work);
+       wiphy_work_cancel(rtwdev->hw->wiphy, &rtwvif_link->update_beacon_work);
        mutex_lock(&rtwdev->mutex);
 
        rtw89_leave_ps_mode(rtwdev);
@@ -198,7 +198,7 @@ static int rtw89_ops_add_interface(struct ieee80211_hw *hw,
 
        rtwvif->offchan = false;
        rtwvif->roc.state = RTW89_ROC_IDLE;
-       INIT_DELAYED_WORK(&rtwvif->roc.roc_work, rtw89_roc_work);
+       wiphy_delayed_work_init(&rtwvif->roc.roc_work, rtw89_roc_work);
 
        rtw89_traffic_stats_init(rtwdev, &rtwvif->stats);
 
@@ -242,7 +242,7 @@ static void rtw89_ops_remove_interface(struct ieee80211_hw *hw,
        rtw89_debug(rtwdev, RTW89_DBG_STATE, "remove vif %pM type %d p2p %d\n",
                    vif->addr, vif->type, vif->p2p);
 
-       cancel_delayed_work_sync(&rtwvif->roc.roc_work);
+       wiphy_delayed_work_cancel(hw->wiphy, &rtwvif->roc.roc_work);
 
        mutex_lock(&rtwdev->mutex);
 
@@ -853,14 +853,13 @@ out:
 static int rtw89_ops_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
                             bool set)
 {
-       struct rtw89_dev *rtwdev = hw->priv;
        struct rtw89_sta *rtwsta = sta_to_rtwsta(sta);
        struct rtw89_vif *rtwvif = rtwsta->rtwvif;
        struct rtw89_vif_link *rtwvif_link;
        unsigned int link_id;
 
        rtw89_vif_for_each_link(rtwvif, rtwvif_link, link_id)
-               ieee80211_queue_work(rtwdev->hw, &rtwvif_link->update_beacon_work);
+               wiphy_work_queue(hw->wiphy, &rtwvif_link->update_beacon_work);
 
        return 0;
 }
@@ -1453,7 +1452,7 @@ static int rtw89_ops_cancel_remain_on_channel(struct ieee80211_hw *hw,
        if (!rtwvif)
                return -EINVAL;
 
-       cancel_delayed_work_sync(&rtwvif->roc.roc_work);
+       wiphy_delayed_work_cancel(hw->wiphy, &rtwvif->roc.roc_work);
 
        mutex_lock(&rtwdev->mutex);
        rtw89_roc_end(rtwdev, rtwvif);
@@ -1751,7 +1750,7 @@ static int rtw89_ops_suspend(struct ieee80211_hw *hw,
        int ret;
 
        set_bit(RTW89_FLAG_FORBIDDEN_TRACK_WROK, rtwdev->flags);
-       cancel_delayed_work_sync(&rtwdev->track_work);
+       wiphy_delayed_work_cancel(hw->wiphy, &rtwdev->track_work);
 
        mutex_lock(&rtwdev->mutex);
        ret = rtw89_wow_suspend(rtwdev, wowlan);
@@ -1778,8 +1777,8 @@ static int rtw89_ops_resume(struct ieee80211_hw *hw)
        mutex_unlock(&rtwdev->mutex);
 
        clear_bit(RTW89_FLAG_FORBIDDEN_TRACK_WROK, rtwdev->flags);
-       ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->track_work,
-                                    RTW89_TRACK_WORK_PERIOD);
+       wiphy_delayed_work_queue(hw->wiphy, &rtwdev->track_work,
+                                RTW89_TRACK_WORK_PERIOD);
 
        return ret ? 1 : 0;
 }
index 5b0cf8314fb2afde384e2de9aba86e65e387373f..2f8694fe4bd1c236d4e13d85f73fd64492041da3 100644 (file)
@@ -4651,7 +4651,7 @@ static void rtw89_phy_cfo_dm(struct rtw89_dev *rtwdev)
        rtw89_phy_cfo_statistics_reset(rtwdev);
 }
 
-void rtw89_phy_cfo_track_work(struct work_struct *work)
+void rtw89_phy_cfo_track_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                cfo_track_work.work);
@@ -4662,8 +4662,8 @@ void rtw89_phy_cfo_track_work(struct work_struct *work)
                goto out;
        rtw89_leave_ps_mode(rtwdev);
        rtw89_phy_cfo_dm(rtwdev);
-       ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->cfo_track_work,
-                                    msecs_to_jiffies(cfo->cfo_timer_ms));
+       wiphy_delayed_work_queue(wiphy, &rtwdev->cfo_track_work,
+                                msecs_to_jiffies(cfo->cfo_timer_ms));
 out:
        mutex_unlock(&rtwdev->mutex);
 }
@@ -4672,8 +4672,8 @@ static void rtw89_phy_cfo_start_work(struct rtw89_dev *rtwdev)
 {
        struct rtw89_cfo_tracking_info *cfo = &rtwdev->cfo_tracking;
 
-       ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->cfo_track_work,
-                                    msecs_to_jiffies(cfo->cfo_timer_ms));
+       wiphy_delayed_work_queue(rtwdev->hw->wiphy, &rtwdev->cfo_track_work,
+                                msecs_to_jiffies(cfo->cfo_timer_ms));
 }
 
 void rtw89_phy_cfo_track(struct rtw89_dev *rtwdev)
@@ -6523,11 +6523,11 @@ static void rtw89_phy_antdiv_training_state(struct rtw89_dev *rtwdev)
        }
 
        antdiv->training_count++;
-       ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->antdiv_work,
-                                    state_period);
+       wiphy_delayed_work_queue(rtwdev->hw->wiphy, &rtwdev->antdiv_work,
+                                state_period);
 }
 
-void rtw89_phy_antdiv_work(struct work_struct *work)
+void rtw89_phy_antdiv_work(struct wiphy *wiphy, struct wiphy_work *work)
 {
        struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
                                                antdiv_work.work);
@@ -6563,7 +6563,7 @@ void rtw89_phy_antdiv_track(struct rtw89_dev *rtwdev)
                return;
 
        antdiv->training_count = 0;
-       ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->antdiv_work, 0);
+       wiphy_delayed_work_queue(rtwdev->hw->wiphy, &rtwdev->antdiv_work, 0);
 }
 
 static void __rtw89_phy_env_monitor_init(struct rtw89_dev *rtwdev,
index 33d466c519e3ac866308a6c3fe67fe476f76ad3b..cec165e222e7d7348036e728cf39b1655c4c11d9 100644 (file)
@@ -978,7 +978,7 @@ void rtw89_phy_rfk_tssi_fill_fwcmd_tmeter_tbl(struct rtw89_dev *rtwdev,
                                              const struct rtw89_chan *chan,
                                              struct rtw89_h2c_rf_tssi *h2c);
 void rtw89_phy_cfo_track(struct rtw89_dev *rtwdev);
-void rtw89_phy_cfo_track_work(struct work_struct *work);
+void rtw89_phy_cfo_track_work(struct wiphy *wiphy, struct wiphy_work *work);
 void rtw89_phy_cfo_parse(struct rtw89_dev *rtwdev, s16 cfo_val,
                         struct rtw89_rx_phy_ppdu *phy_ppdu);
 void rtw89_phy_stat_track(struct rtw89_dev *rtwdev);
@@ -991,7 +991,7 @@ void rtw89_phy_tx_path_div_track(struct rtw89_dev *rtwdev);
 void rtw89_phy_antdiv_parse(struct rtw89_dev *rtwdev,
                            struct rtw89_rx_phy_ppdu *phy_ppdu);
 void rtw89_phy_antdiv_track(struct rtw89_dev *rtwdev);
-void rtw89_phy_antdiv_work(struct work_struct *work);
+void rtw89_phy_antdiv_work(struct wiphy *wiphy, struct wiphy_work *work);
 void rtw89_phy_set_bss_color(struct rtw89_dev *rtwdev,
                             struct rtw89_vif_link *rtwvif_link);
 void rtw89_phy_tssi_ctrl_set_bandedge_cfg(struct rtw89_dev *rtwdev,
index d0c8584308c06ef97a2043b346150971a8497b9b..9658672ad2744923515be80960c5ee68ba95a190 100644 (file)
@@ -485,10 +485,13 @@ static void ser_l1_reset_pre_st_hdl(struct rtw89_ser *ser, u8 evt)
 static void ser_reset_trx_st_hdl(struct rtw89_ser *ser, u8 evt)
 {
        struct rtw89_dev *rtwdev = container_of(ser, struct rtw89_dev, ser);
+       struct wiphy *wiphy = rtwdev->hw->wiphy;
 
        switch (evt) {
        case SER_EV_STATE_IN:
-               cancel_delayed_work_sync(&rtwdev->track_work);
+               wiphy_lock(wiphy);
+               wiphy_delayed_work_cancel(wiphy, &rtwdev->track_work);
+               wiphy_unlock(wiphy);
                drv_stop_tx(ser);
 
                if (hal_stop_dma(ser)) {
@@ -519,8 +522,8 @@ static void ser_reset_trx_st_hdl(struct rtw89_ser *ser, u8 evt)
                hal_enable_dma(ser);
                drv_resume_rx(ser);
                drv_resume_tx(ser);
-               ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->track_work,
-                                            RTW89_TRACK_WORK_PERIOD);
+               wiphy_delayed_work_queue(wiphy, &rtwdev->track_work,
+                                        RTW89_TRACK_WORK_PERIOD);
                break;
 
        default: