From patchwork Mon Dec 30 19:41:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 13923442 X-Patchwork-Delegate: nbd@nbd.name Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF0B5199239 for ; Mon, 30 Dec 2024 19:42:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; cv=none; b=bo0YQBq8KXcXf0xzByWGNsu8ze8nSfPpJZi9MFrQLJkRisR68HDwf+tWp6Xzka7Lpl5kAa2OHLuGxXlclbPPZDfcZensIb6AS5MJJZChAfukXK8RAD8k4Zdm4NLjdJj3EqhIDPBjZGfy5jEZX8rerzklJpSU35WfSUTRElnasfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735587734; c=relaxed/simple; bh=pTf9uhR1HwlZ+soMlkK38UIRVXh9fqs8tsLEkzaLZW8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o2QNTAtt04DWrcjOy9C5z3JymR0pftKuHePzYW+WVaBQ24eTGKKyYF5rPFjL9B20EVV167PzK1zRKD5b8+dlG3fIdYt2g9OGS6ctWSWemC3ueNUi+I8oZSyPEECmrpp+ZWXqeG+QiHWbqoKRyCtVvMCGOYv77+KA/tZHtdXYQNE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=Cg/8cN/L; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="Cg/8cN/L" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WY6NKapy3IhvOS+IgMFpSYa19SNn9ZBnMgIOk5zBFec=; b=Cg/8cN/LG95eEwmck/Bg7/K37D h9hMxvmdwNWUvq53LAcLqS+ae5KtHLp3BxbB76AsbK3766GXp6RqwuoUBpd8r16DdWiSwaxFge4zH xQePn2aZOj/xUz+WDADqaNPAKYqZYypNNeYIItBDtSNyJOWfb8cgI1BmaEDwP8NfsNf4=; Received: from p4ff13c5f.dip0.t-ipconnect.de ([79.241.60.95] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1tSLeV-00GKzc-05 for linux-wireless@vger.kernel.org; Mon, 30 Dec 2024 20:42:11 +0100 From: Felix Fietkau 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 Message-ID: <20241230194202.95065-10-nbd@nbd.name> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241230194202.95065-1-nbd@nbd.name> References: <20241230194202.95065-1-nbd@nbd.name> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Avoid issuing MCU calls during a hardware restart Signed-off-by: Felix Fietkau --- 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;