Skip to content
Snippets Groups Projects
Commit e7336475 authored by Felix Fietkau's avatar Felix Fietkau
Browse files

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: default avatarFelix Fietkau <nbd@nbd.name>
parent 82d6f1ad
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment