From: Aditya Kumar Singh Date: Thu, 26 Jun 2025 05:19:56 +0000 (+0530) Subject: wifi: ath12k: fix timeout while waiting for regulatory update during interface creation X-Git-Tag: io_uring-6.17-20250815~128^2~34^2~21^2~44 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=6e17bbb5a86e6c68d65e38dfc850699e7a0706cb;p=linux-block.git wifi: ath12k: fix timeout while waiting for regulatory update during interface creation During interface creation, following print is observed on the console - Timeout while waiting for regulatory update This occurs due to commit 906619a00967 ("wifi: ath12k: handle regulatory hints during mac registration"), which introduced a completion mechanism to synchronize the regulatory update process. The intent behind this change is to coordinate the timing between when the firmware sends regulatory data to the driver and when the driver processes that data. However, during interface addition, if the 6 GHz band is active, the driver invokes ath12k_regd_update() to apply the appropriate 6 GHz power mode regulatory settings. At this point, there is no interaction with the firmware, so the completion object is not reinitialized. As a result, wait_for_completion() eventually times out, leading to the observed error log message. Hence to fix this, move all complete() on regd_update_completed to complete_all(). The complete() function signals only once, causing any subsequent waits without reinitialization to timeout. In this scenario, since waiting is unnecessary, complete_all() can be used instead, ensuring that subsequent calls to wait without reinitialization will simply bail out and not actually wait. This approach is ideal because if the firmware is not involved, there is no need to wait for the completion event. However, if the firmware is involved, it is guaranteed that the completion will be reinitialized, and thus, it would wait. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1 Tested-by: Kang Yang Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Fixes: 906619a00967 ("wifi: ath12k: handle regulatory hints during mac registration") Signed-off-by: Aditya Kumar Singh Link: https://patch.msgid.link/20250626-fix_timeout_during_interface_creation-v1-1-90a7fdc222d4@oss.qualcomm.com Signed-off-by: Jeff Johnson --- diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 83caba3104d6..ffc19a6b9485 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -1475,7 +1475,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) complete(&ar->vdev_setup_done); complete(&ar->vdev_delete_done); complete(&ar->bss_survey_done); - complete(&ar->regd_update_completed); + complete_all(&ar->regd_update_completed); wake_up(&ar->dp.tx_empty_waitq); idr_for_each(&ar->txmgmt_idr, diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index f565db7b7b44..71e07c546a2d 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -12794,7 +12794,7 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah) * proceeding with registration. */ for_each_ar(ah, ar, i) - complete(&ar->regd_update_completed); + complete_all(&ar->regd_update_completed); ret = ieee80211_register_hw(hw); if (ret) { diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c index d6efbea2e724..6c6354b3e18e 100644 --- a/drivers/net/wireless/ath/ath12k/wmi.c +++ b/drivers/net/wireless/ath/ath12k/wmi.c @@ -6769,7 +6769,7 @@ out: * before registering the hardware. */ if (ar) - complete(&ar->regd_update_completed); + complete_all(&ar->regd_update_completed); return ret; }