linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 10/14] wifi: mt76: mt7915: hold dev->mutex while interacting with the thermal state
Date: Mon, 30 Dec 2024 20:41:58 +0100	[thread overview]
Message-ID: <20241230194202.95065-10-nbd@nbd.name> (raw)
In-Reply-To: <20241230194202.95065-1-nbd@nbd.name>

Avoid issuing MCU calls during a hardware restart

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt7915/init.c | 7 +++++--
 1 file 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;
 
-- 
2.47.1


  parent reply	other threads:[~2024-12-30 19:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-30 19:41 [PATCH 01/14] wifi: mt76: remove mt76_calculate_default_rate() Felix Fietkau
2024-12-30 19:41 ` [PATCH 02/14] wifi: mt76: mt7996: remove phy->monitor_vif Felix Fietkau
2024-12-30 19:41 ` [PATCH 03/14] wifi: mt76: mt7915: fix slot time for 5/6GHz Felix Fietkau
2024-12-30 19:41 ` [PATCH 04/14] wifi: mt76: mt7915: fix eifs value on older chipsets Felix Fietkau
2024-12-30 19:41 ` [PATCH 05/14] wifi: mt76: mt7996: fix rx filter setting for bfee functionality Felix Fietkau
2024-12-30 19:41 ` [PATCH 06/14] wifi: mt76: mt7915: reduce the number of command retries Felix Fietkau
2024-12-30 19:41 ` [PATCH 07/14] wifi: mt76: mt7915: decrease timeout for commonly issued MCU commands Felix Fietkau
2024-12-30 19:41 ` [PATCH 08/14] wifi: mt76: only enable tx worker after setting the channel Felix Fietkau
2024-12-30 19:41 ` [PATCH 09/14] wifi: mt76: mt7915: ensure that only one sta entry is active per mac address Felix Fietkau
2024-12-30 19:41 ` Felix Fietkau [this message]
2024-12-30 19:41 ` [PATCH 11/14] wifi: mt76: mt7915: firmware restart on devices with a second pcie link Felix Fietkau
2024-12-30 19:42 ` [PATCH 12/14] wifi: mt76: mt7915: fix omac index assignment after hardware reset Felix Fietkau
2024-12-30 19:42 ` [PATCH 13/14] wifi: mt76: mt7996: use mac80211 .sta_state op Felix Fietkau
2024-12-30 19:42 ` [PATCH 14/14] wifi: mt76: do not add wcid entries to sta poll list during MCU reset Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241230194202.95065-10-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).