diff options
author | Felix Fietkau <nbd@nbd.name> | 2024-12-30 22:41:58 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2025-01-14 15:34:36 +0300 |
commit | e733647566ecbf7a261e583f49320855f0c33221 (patch) | |
tree | f0795e3723ae1fdf5039b3fb0231c93136accd73 | |
parent | 82d6f1adfede540c6842173175c09b2bd3ebbe75 (diff) | |
download | linux-e733647566ecbf7a261e583f49320855f0c33221.tar.xz |
wifi: mt76: mt7915: hold dev->mutex while interacting with the thermal state
Avoid issuing MCU calls during a hardware restart
Link: https://patch.msgid.link/20241230194202.95065-10-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7915/init.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index 4282857d8ce9..c530435b19b5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -53,7 +53,9 @@ static ssize_t mt7915_thermal_temp_show(struct device *dev, switch (i) { case 0: + mutex_lock(&phy->dev->mt76.mutex); temperature = mt7915_mcu_get_temperature(phy); + mutex_unlock(&phy->dev->mt76.mutex); if (temperature < 0) return temperature; /* display in millidegree celcius */ @@ -95,9 +97,8 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev, } phy->throttle_temp[i - 1] = val; - mutex_unlock(&phy->dev->mt76.mutex); - ret = mt7915_mcu_set_thermal_protect(phy); + mutex_unlock(&phy->dev->mt76.mutex); if (ret) return ret; @@ -159,7 +160,9 @@ mt7915_thermal_set_cur_throttle_state(struct thermal_cooling_device *cdev, * cooling_device convention: 0 = no cooling, more = more cooling * mcu convention: 1 = max cooling, more = less cooling */ + mutex_lock(&phy->dev->mt76.mutex); ret = mt7915_mcu_set_thermal_throttling(phy, throttling); + mutex_unlock(&phy->dev->mt76.mutex); if (ret) return ret; |