Skip to contentSkip to conversation

mt76: mac: run mt76x02_mac_work routine atomically

PATCH Applied Lorenzo Bianconi 2 participants 2 messages Dec 6, 2018 – Dec 28, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 mt76: mac: run mt76x02_mac_work routine atomically

In reply to a message not in the archive

Grab mt76_dev mutex in mt76x02_mac_work handler since it runs concurrently with mt76x{0,2}_set_channel routines

---
 drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +4 -0
index 490368dc9325..64841f40cdcf 100644
@@ -784,6 +784,8 @@ void mt76x02_mac_work(struct work_struct *work)
 					       mac_work.work);
 	int i, idx;
 
+	mutex_lock(&dev->mt76.mutex);
+
 	mt76x02_update_channel(&dev->mt76);
 	for (i = 0, idx = 0; i < 16; i++) {
 		u32 val = mt76_rr(dev, MT_TX_AGG_CNT(i));
@@ -796,6 +798,8 @@ void mt76x02_mac_work(struct work_struct *work)
 	if (!dev->beacon_mask)
 		mt76x02_check_mac_err(dev);
 
+	mutex_unlock(&dev->mt76.mutex);
+
 	mt76_tx_status_check(&dev->mt76, NULL, false);
 
 	ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work,
Signature · 1 line
2.19.2