mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: mt7915: hold dev->mutex while interacting with the thermal state
Avoid issuing MCU calls during a hardware restart Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
+5
-2
@@ -52,7 +52,9 @@ static ssize_t mt7915_thermal_temp_show(struct device *dev,
|
|||||||
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
|
mutex_lock(&phy->dev->mt76.mutex);
|
||||||
temperature = mt7915_mcu_get_temperature(phy);
|
temperature = mt7915_mcu_get_temperature(phy);
|
||||||
|
mutex_unlock(&phy->dev->mt76.mutex);
|
||||||
if (temperature < 0)
|
if (temperature < 0)
|
||||||
return temperature;
|
return temperature;
|
||||||
/* display in millidegree celcius */
|
/* display in millidegree celcius */
|
||||||
@@ -94,9 +96,8 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
phy->throttle_temp[i - 1] = val;
|
phy->throttle_temp[i - 1] = val;
|
||||||
mutex_unlock(&phy->dev->mt76.mutex);
|
|
||||||
|
|
||||||
ret = mt7915_mcu_set_thermal_protect(phy);
|
ret = mt7915_mcu_set_thermal_protect(phy);
|
||||||
|
mutex_unlock(&phy->dev->mt76.mutex);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@@ -158,7 +159,9 @@ mt7915_thermal_set_cur_throttle_state(struct thermal_cooling_device *cdev,
|
|||||||
* cooling_device convention: 0 = no cooling, more = more cooling
|
* cooling_device convention: 0 = no cooling, more = more cooling
|
||||||
* mcu convention: 1 = max cooling, more = less cooling
|
* mcu convention: 1 = max cooling, more = less cooling
|
||||||
*/
|
*/
|
||||||
|
mutex_lock(&phy->dev->mt76.mutex);
|
||||||
ret = mt7915_mcu_set_thermal_throttling(phy, throttling);
|
ret = mt7915_mcu_set_thermal_throttling(phy, throttling);
|
||||||
|
mutex_unlock(&phy->dev->mt76.mutex);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user