]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set
authorLorenzo Bianconi <lorenzo@kernel.org>
Sat, 11 May 2019 15:30:10 +0000 (17:30 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 25 Jun 2019 10:55:27 +0000 (12:55 +0200)
Run mt76x02_edcca_init atomically in mt76_edcca_set since it runs
concurrently with calibration work and mt76x2_set_channel.
Moreover perform phy calibration atomically

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c

index 7853078e8ca4ba1a23e57da3afc2351f42165557..f412c779d8e26bfdc0578910b10688a2c48a7f1b 100644 (file)
@@ -122,11 +122,15 @@ mt76_edcca_set(void *data, u64 val)
        struct mt76x02_dev *dev = data;
        enum nl80211_dfs_regions region = dev->dfs_pd.region;
 
+       mutex_lock(&dev->mt76.mutex);
+
        dev->ed_monitor_enabled = !!val;
        dev->ed_monitor = dev->ed_monitor_enabled &&
                          region == NL80211_DFS_ETSI;
        mt76x02_edcca_init(dev);
 
+       mutex_unlock(&dev->mt76.mutex);
+
        return 0;
 }
 
index 7a39a390a7ac879b2c2ac73985508d4055d87b84..2edf1bd0c18cbd450058f388fbe8c60f242741df 100644 (file)
@@ -294,10 +294,16 @@ void mt76x2_phy_calibrate(struct work_struct *work)
        struct mt76x02_dev *dev;
 
        dev = container_of(work, struct mt76x02_dev, cal_work.work);
+
+       mutex_lock(&dev->mt76.mutex);
+
        mt76x2_phy_channel_calibrate(dev, false);
        mt76x2_phy_tssi_compensate(dev);
        mt76x2_phy_temp_compensate(dev);
        mt76x2_phy_update_channel_gain(dev);
+
+       mutex_unlock(&dev->mt76.mutex);
+
        ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);
 }
index c7208c5375ac1cd7c8a8933f331f0726a0bdff76..dfd54f9b0e97fc867f165d18c653154e74687891 100644 (file)
@@ -55,10 +55,15 @@ void mt76x2u_phy_calibrate(struct work_struct *work)
        struct mt76x02_dev *dev;
 
        dev = container_of(work, struct mt76x02_dev, cal_work.work);
+
+       mutex_lock(&dev->mt76.mutex);
+
        mt76x2u_phy_channel_calibrate(dev, false);
        mt76x2_phy_tssi_compensate(dev);
        mt76x2_phy_update_channel_gain(dev);
 
+       mutex_unlock(&dev->mt76.mutex);
+
        ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
                                     MT_CALIBRATE_INTERVAL);
 }