]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
mt7615: mcu: unify mt7615_mcu_add_wtbl_bmc and mt7615_mcu_del_wtbl_bmc
authorLorenzo Bianconi <lorenzo@kernel.org>
Sat, 4 May 2019 15:28:58 +0000 (17:28 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 25 Jun 2019 10:55:26 +0000 (12:55 +0200)
Remove duplicated code in mt7615_bss_info_changed

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/main.c
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h

index 8d7a47d1b20553a750e95b124557d03ae5e1138a..98c18c27328eefe45cde0e252285a78a7f2741a4 100644 (file)
@@ -291,17 +291,10 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
         */
 
        if (changed & BSS_CHANGED_BEACON_ENABLED) {
-               if (info->enable_beacon) {
-                       mt7615_mcu_set_bss_info(dev, vif, 1);
-                       mt7615_mcu_add_wtbl_bmc(dev, vif);
-                       mt7615_mcu_set_sta_rec_bmc(dev, vif, 1);
-                       mt7615_mcu_set_bcn(dev, vif, 1);
-               } else {
-                       mt7615_mcu_set_sta_rec_bmc(dev, vif, 0);
-                       mt7615_mcu_del_wtbl_bmc(dev, vif);
-                       mt7615_mcu_set_bss_info(dev, vif, 0);
-                       mt7615_mcu_set_bcn(dev, vif, 0);
-               }
+               mt7615_mcu_set_bss_info(dev, vif, info->enable_beacon);
+               mt7615_mcu_wtbl_bmc(dev, vif, info->enable_beacon);
+               mt7615_mcu_set_sta_rec_bmc(dev, vif, info->enable_beacon);
+               mt7615_mcu_set_bcn(dev, vif, info->enable_beacon);
        }
 
        mutex_unlock(&dev->mt76.mutex);
index 2bda4830dbaf3aeb81d71b94f704371a9363bf29..b1062c7fd5d128b08b44a35a596af184dbe17093 100644 (file)
@@ -987,10 +987,10 @@ int mt7615_mcu_set_wtbl_key(struct mt7615_dev *dev, int wcid,
                                     &wtbl_sec_key, buf_len);
 }
 
-int mt7615_mcu_add_wtbl_bmc(struct mt7615_dev *dev,
-                           struct ieee80211_vif *vif)
+static int
+mt7615_mcu_add_wtbl_bmc(struct mt7615_dev *dev,
+                       struct mt7615_vif *mvif)
 {
-       struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
        struct {
                struct wtbl_generic g_wtbl;
                struct wtbl_rx rx_wtbl;
@@ -1016,10 +1016,14 @@ int mt7615_mcu_add_wtbl_bmc(struct mt7615_dev *dev,
                                     sizeof(struct wtbl_rx));
 }
 
-int mt7615_mcu_del_wtbl_bmc(struct mt7615_dev *dev, struct ieee80211_vif *vif)
+int mt7615_mcu_wtbl_bmc(struct mt7615_dev *dev,
+                       struct ieee80211_vif *vif, bool enable)
 {
        struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
 
+       if (enable)
+               return mt7615_mcu_add_wtbl_bmc(dev, mvif);
+
        return __mt7615_mcu_set_wtbl(dev, mvif->sta.wcid.idx,
                                     WTBL_RESET_AND_SET, 0, NULL, 0);
 }
index 895c2904d7ebf6059b5c87df469e350a3b560235..2331f0a9bc65f7b83522968943d8100dccd495ff 100644 (file)
@@ -118,8 +118,8 @@ int mt7615_mcu_set_wtbl_key(struct mt7615_dev *dev, int wcid,
 void mt7615_mcu_set_rates(struct mt7615_dev *dev, struct mt7615_sta *sta,
                          struct ieee80211_tx_rate *probe_rate,
                          struct ieee80211_tx_rate *rates);
-int mt7615_mcu_add_wtbl_bmc(struct mt7615_dev *dev, struct ieee80211_vif *vif);
-int mt7615_mcu_del_wtbl_bmc(struct mt7615_dev *dev, struct ieee80211_vif *vif);
+int mt7615_mcu_wtbl_bmc(struct mt7615_dev *dev, struct ieee80211_vif *vif,
+                       bool enable);
 int mt7615_mcu_add_wtbl(struct mt7615_dev *dev, struct ieee80211_vif *vif,
                        struct ieee80211_sta *sta);
 int mt7615_mcu_del_wtbl(struct mt7615_dev *dev, struct ieee80211_vif *vif,