[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b06a0703d4a825b1db17f3213814ddc42644a5b.1767611788.git.jan.kiszka@siemens.com>
Date: Mon, 5 Jan 2026 12:16:26 +0100
From: Jan Kiszka <jan.kiszka@...mens.com>
To: stable@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Felix Fietkau <nbd@....name>,
Quan Zhou <quan.zhou@...iatek.com>
Cc: Sasha Levin <sashal@...nel.org>,
linux-kernel@...r.kernel.org,
linux-wireless@...r.kernel.org
Subject: [PATCH 6.12 1/3] wifi: mt76: mt7925: fix the unfinished command of regd_notifier before suspend
From: Quan Zhou <quan.zhou@...iatek.com>
[ Upstream commit 1b97fc8443aea01922560de9f24a6383e6eb6ae8 ]
Before entering suspend, we need to ensure that all MCU command are
completed. In some cases, such as with regd_notifier, there is a
chance that CLC commands, will be executed before suspend.
Signed-off-by: Quan Zhou <quan.zhou@...iatek.com>
Link: https://patch.msgid.link/3af7b4e5bf7437832b016e32743657d1d55b1f9d.1735910288.git.quan.zhou@mediatek.com
Signed-off-by: Felix Fietkau <nbd@....name>
Signed-off-by: Jan Kiszka <jan.kiszka@...mens.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/init.c | 4 ++++
drivers/net/wireless/mediatek/mt76/mt7925/pci.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/init.c b/drivers/net/wireless/mediatek/mt76/mt7925/init.c
index 5123a720413f..3f48ae80aed4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/init.c
@@ -81,11 +81,14 @@ mt7925_regd_notifier(struct wiphy *wiphy,
mdev->region = req->dfs_region;
dev->country_ie_env = req->country_ie_env;
+ dev->regd_in_progress = true;
mt792x_mutex_acquire(dev);
mt7925_mcu_set_clc(dev, req->alpha2, req->country_ie_env);
mt7925_mcu_set_channel_domain(hw->priv);
mt7925_set_tx_sar_pwr(hw, NULL);
mt792x_mutex_release(dev);
+ dev->regd_in_progress = false;
+ wake_up(&dev->wait);
}
static void mt7925_mac_init_basic_rates(struct mt792x_dev *dev)
@@ -235,6 +238,7 @@ int mt7925_register_device(struct mt792x_dev *dev)
spin_lock_init(&dev->pm.wake.lock);
mutex_init(&dev->pm.mutex);
init_waitqueue_head(&dev->pm.wait);
+ init_waitqueue_head(&dev->wait);
spin_lock_init(&dev->pm.txq_lock);
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt792x_mac_work);
INIT_DELAYED_WORK(&dev->phy.scan_work, mt7925_scan_work);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
index 5e428f19f972..b4cc5607e0d6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/pci.c
@@ -455,6 +455,9 @@ static int mt7925_pci_suspend(struct device *device)
if (err < 0)
goto restore_suspend;
+ wait_event_timeout(dev->wait,
+ !dev->regd_in_progress, 5 * HZ);
+
/* always enable deep sleep during suspend to reduce
* power consumption
*/
--
2.51.0
Powered by blists - more mailing lists