diff mbox series

mt76: mt7915: cleanup miscellaneous errors and redundant codes

Message ID 20210702083949.4431-1-bo.jiao@mediatek.com
State New
Headers show
Series mt76: mt7915: cleanup miscellaneous errors and redundant codes | expand

Commit Message

Bo Jiao July 2, 2021, 8:39 a.m. UTC
From: Bo Jiao <Bo.Jiao@mediatek.com>


cleanup miscellaneous errors and redundant codes.

Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>

---
 drivers/net/wireless/mediatek/mt76/mt7915/init.c |  2 +-
 drivers/net/wireless/mediatek/mt76/mt7915/mac.c  | 10 +++-------
 drivers/net/wireless/mediatek/mt76/mt7915/main.c |  2 +-
 drivers/net/wireless/mediatek/mt76/mt7915/mcu.c  |  7 +------
 4 files changed, 6 insertions(+), 15 deletions(-)

-- 
2.18.0

Comments

Kalle Valo July 5, 2021, 12:57 p.m. UTC | #1
Bo Jiao <bo.jiao@mediatek.com> writes:

> From: Bo Jiao <Bo.Jiao@mediatek.com>

>

> cleanup miscellaneous errors and redundant codes.

>

> Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>


Please split this to smaller patches, one fix per patch and write proper
commit logs. See more info in the wiki below.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Bo Jiao July 6, 2021, 2:23 a.m. UTC | #2
On Mon, 2021-07-05 at 15:57 +0300, Kalle Valo wrote:
> Bo Jiao <bo.jiao@mediatek.com> writes:

> 

> > From: Bo Jiao <Bo.Jiao@mediatek.com>

> >

> > cleanup miscellaneous errors and redundant codes.

> >

> > Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>

> 

> Please split this to smaller patches, one fix per patch and write proper

> commit logs. See more info in the wiki below.

> 

hi Kalle, got it, i will modify it ASAP.
hi Felix, please drop this one, i will split this to smaller patches
with proper logs. thanks
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 4798d6344305..1d2214519f5a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -480,7 +480,7 @@  static int mt7915_init_hardware(struct mt7915_dev *dev)
 	}
 
 	/* Beacon and mgmt frames should occupy wcid 0 */
-	idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA - 1);
+	idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
 	if (idx)
 		return -ENOSPC;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index 2462704094b0..186a8f44abb8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -1377,13 +1377,9 @@  void mt7915_mac_reset_counters(struct mt7915_phy *phy)
 		mt76_rr(dev, MT_TX_AGG_CNT2(ext_phy, i));
 	}
 
-	if (ext_phy) {
-		dev->mt76.phy2->survey_time = ktime_get_boottime();
-		i = ARRAY_SIZE(dev->mt76.aggr_stats) / 2;
-	} else {
-		dev->mt76.phy.survey_time = ktime_get_boottime();
-		i = 0;
-	}
+	phy->mt76->survey_time = ktime_get_boottime();
+	i = ext_phy ? ARRAY_SIZE(dev->mt76.aggr_stats) / 2 : 0;
+
 	memset(&dev->mt76.aggr_stats[i], 0, sizeof(dev->mt76.aggr_stats) / 2);
 
 	/* reset airtime counters */
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index c25f8da590dd..d8abebcffe4b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -613,7 +613,7 @@  int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 	struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
 	int ret, idx;
 
-	idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA - 1);
+	idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA);
 	if (idx < 0)
 		return -ENOSPC;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index 863aa18b3024..62160ca721b8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -975,12 +975,7 @@  mt7915_mcu_bss_rfch_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
 	}
 
 	if (vif->bss_conf.he_support && vif->type == NL80211_IFTYPE_STATION) {
-		struct mt7915_dev *dev = phy->dev;
-		struct mt76_phy *mphy = &dev->mt76.phy;
-		bool ext_phy = phy != &dev->phy;
-
-		if (ext_phy && dev->mt76.phy2)
-			mphy = dev->mt76.phy2;
+		struct mt76_phy *mphy = phy->mt76;
 
 		ch->he_ru26_block =
 			mt7915_check_he_obss_narrow_bw_ru(mphy->hw, vif);