]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath12k: refactor ath12k_mac_setup_channels_rates()
authorKarthikeyan Periyasamy <quic_periyasa@quicinc.com>
Sun, 14 Jan 2024 15:02:39 +0000 (17:02 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Tue, 16 Jan 2024 12:19:45 +0000 (14:19 +0200)
Currently, the MAC setup helper function is accessing the mac80211 hw
data. In the future, to support single/multi link operation, need to
decouple the mac80211 hw data from this helper function so that it can be
easy to scale these functions to support single/multi link operations. So
remove the mac80211 hw access from the ath12k_mac_setup_channels_rates()
helper function.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20231206034920.1037449-4-quic_periyasa@quicinc.com
drivers/net/wireless/ath/ath12k/mac.c

index 09a1a2edf8420662c463f539ff110f0f6f727383..33e03208479d0a0c969c5a1fdbaf3ec0e3e7b4f9 100644 (file)
@@ -7158,9 +7158,9 @@ static u32 ath12k_get_phy_id(struct ath12k *ar, u32 band)
 }
 
 static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
-                                          u32 supported_bands)
+                                          u32 supported_bands,
+                                          struct ieee80211_supported_band *bands[])
 {
-       struct ieee80211_hw *hw = ar->hw;
        struct ieee80211_supported_band *band;
        struct ath12k_wmi_hal_reg_capabilities_ext_arg *reg_cap;
        void *channels;
@@ -7186,7 +7186,7 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
                band->channels = channels;
                band->n_bitrates = ath12k_g_rates_size;
                band->bitrates = ath12k_g_rates;
-               hw->wiphy->bands[NL80211_BAND_2GHZ] = band;
+               bands[NL80211_BAND_2GHZ] = band;
 
                if (ar->ab->hw_params->single_pdev_only) {
                        phy_id = ath12k_get_phy_id(ar, WMI_HOST_WLAN_2G_CAP);
@@ -7213,7 +7213,7 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
                        band->channels = channels;
                        band->n_bitrates = ath12k_a_rates_size;
                        band->bitrates = ath12k_a_rates;
-                       hw->wiphy->bands[NL80211_BAND_6GHZ] = band;
+                       bands[NL80211_BAND_6GHZ] = band;
                        ath12k_mac_update_ch_list(ar, band,
                                                  reg_cap->low_5ghz_chan,
                                                  reg_cap->high_5ghz_chan);
@@ -7235,7 +7235,7 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar,
                        band->channels = channels;
                        band->n_bitrates = ath12k_a_rates_size;
                        band->bitrates = ath12k_a_rates;
-                       hw->wiphy->bands[NL80211_BAND_5GHZ] = band;
+                       bands[NL80211_BAND_5GHZ] = band;
 
                        if (ar->ab->hw_params->single_pdev_only) {
                                phy_id = ath12k_get_phy_id(ar, WMI_HOST_WLAN_5G_CAP);
@@ -7414,7 +7414,8 @@ static int __ath12k_mac_register(struct ath12k *ar)
        SET_IEEE80211_DEV(hw, ab->dev);
 
        ret = ath12k_mac_setup_channels_rates(ar,
-                                             cap->supported_bands);
+                                             cap->supported_bands,
+                                             hw->wiphy->bands);
        if (ret)
                goto err;