]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: remove mt76_calculate_default_rate()
authorFelix Fietkau <nbd@nbd.name>
Mon, 30 Dec 2024 19:41:49 +0000 (20:41 +0100)
committerFelix Fietkau <nbd@nbd.name>
Tue, 14 Jan 2025 12:34:36 +0000 (13:34 +0100)
It is only used in mt76_connac2_mac_tx_rate_val, inline it there.

Link: https://patch.msgid.link/20241230194202.95065-1-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mac80211.c
drivers/net/wireless/mediatek/mt76/mt76.h
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c

index 7fbce5e757df59e46522250a29c7c13ce3f35ebe..57c7b681645a68cd4a278f25e7d4350b816c359a 100644 (file)
@@ -1808,30 +1808,6 @@ mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
 }
 EXPORT_SYMBOL_GPL(mt76_init_queue);
 
-u16 mt76_calculate_default_rate(struct mt76_phy *phy,
-                               struct ieee80211_vif *vif, int rateidx)
-{
-       struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
-       struct cfg80211_chan_def *chandef = mvif->ctx ?
-                                           &mvif->ctx->def :
-                                           &phy->chandef;
-       int offset = 0;
-
-       if (chandef->chan->band != NL80211_BAND_2GHZ)
-               offset = 4;
-
-       /* pick the lowest rate for hidden nodes */
-       if (rateidx < 0)
-               rateidx = 0;
-
-       rateidx += offset;
-       if (rateidx >= ARRAY_SIZE(mt76_rates))
-               rateidx = offset;
-
-       return mt76_rates[rateidx].hw_value;
-}
-EXPORT_SYMBOL_GPL(mt76_calculate_default_rate);
-
 void mt76_ethtool_worker(struct mt76_ethtool_worker_info *wi,
                         struct mt76_sta_stats *stats, bool eht)
 {
index 599123967af6111be0d865df6ffbafc794eadb76..3bc591c14b65d262e4791ca0d5d877b218367cb8 100644 (file)
@@ -1192,8 +1192,6 @@ int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep,
 struct mt76_queue *
 mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
                int ring_base, void *wed, u32 flags);
-u16 mt76_calculate_default_rate(struct mt76_phy *phy,
-                               struct ieee80211_vif *vif, int rateidx);
 static inline int mt76_init_tx_queue(struct mt76_phy *phy, int qid, int idx,
                                     int n_desc, int ring_base, void *wed,
                                     u32 flags)
index a3db65254e37fdaa494a7b311b80fb8ecb7c22c0..a72551ba27e46fec1034da9b468b2ac929857bd6 100644 (file)
@@ -299,6 +299,7 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy,
                                            &mvif->ctx->def : &mphy->chandef;
        u8 nss = 0, mode = 0, band = chandef->chan->band;
        int rateidx = 0, mcast_rate;
+       int offset = 0;
 
        if (!vif)
                goto legacy;
@@ -330,7 +331,18 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy,
                rateidx = ffs(vif->bss_conf.basic_rates) - 1;
 
 legacy:
-       rateidx = mt76_calculate_default_rate(mphy, vif, rateidx);
+       if (band != NL80211_BAND_2GHZ)
+               offset = 4;
+
+       /* pick the lowest rate for hidden nodes */
+       if (rateidx < 0)
+               rateidx = 0;
+
+       rateidx += offset;
+       if (rateidx >= ARRAY_SIZE(mt76_rates))
+               rateidx = offset;
+
+       rateidx = mt76_rates[rateidx].hw_value;
        mode = rateidx >> 8;
        rateidx &= GENMASK(7, 0);
 out: