Skip to content

Commit bb57768

Browse files
LorenzoBianconinbd168
authored andcommitted
mt76: add missing lock configuring coverage class
Coverage class callback can potentially run in parallel with other routines (e.g. mt7615_set_channel) that configures timing registers. Run coverage class callback holding mt76 mutex Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
1 parent 1806c13 commit bb57768

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

drivers/net/wireless/mediatek/mt76/mt7603/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,10 @@ mt7603_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
642642
{
643643
struct mt7603_dev *dev = hw->priv;
644644

645+
mutex_lock(&dev->mt76.mutex);
645646
dev->coverage_class = max_t(s16, coverage_class, 0);
646647
mt7603_mac_set_timing(dev);
648+
mutex_unlock(&dev->mt76.mutex);
647649
}
648650

649651
static void mt7603_tx(struct ieee80211_hw *hw,

drivers/net/wireless/mediatek/mt76/mt7615/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,9 +735,12 @@ static void
735735
mt7615_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
736736
{
737737
struct mt7615_phy *phy = mt7615_hw_phy(hw);
738+
struct mt7615_dev *dev = phy->dev;
738739

740+
mutex_lock(&dev->mt76.mutex);
739741
phy->coverage_class = max_t(s16, coverage_class, 0);
740742
mt7615_mac_set_timing(phy);
743+
mutex_unlock(&dev->mt76.mutex);
741744
}
742745

743746
static int

drivers/net/wireless/mediatek/mt76/mt7915/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,12 @@ static void
716716
mt7915_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
717717
{
718718
struct mt7915_phy *phy = mt7915_hw_phy(hw);
719+
struct mt7915_dev *dev = phy->dev;
719720

721+
mutex_lock(&dev->mt76.mutex);
720722
phy->coverage_class = max_t(s16, coverage_class, 0);
721723
mt7915_mac_set_timing(phy);
724+
mutex_unlock(&dev->mt76.mutex);
722725
}
723726

724727
static int

0 commit comments

Comments
 (0)