Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8aac454d authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: mt76x02: run mt76x02_edcca_init atomically in mt76_edcca_set



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: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 6e4caaea
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;
}

+6 −0
Original line number Diff line number Diff line
@@ -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);
}
+5 −0
Original line number Diff line number Diff line
@@ -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);
}