From b6f786391b02598761e0ee5392176828d94dbf7e Mon Sep 17 00:00:00 2001 From: Yu Ouyang Date: Mon, 28 Feb 2022 17:21:40 +0800 Subject: [PATCH] qcacld-3.0: Avoid calling idle shutdown many times Shutdown in suspend phase, idle shutdown timer will be invoked if all adapters closed. And then driver suspend function will return EAGAIN to user space to try suspend again. Idle shutdown will be finished in ~1s. Thus, Idle shutdown timer may be called for many times when user space try suspend again. So, add flag to avoid calling idle shutdown many times. Change-Id: Ic701dce917288db09511f6ffc540cf8cf3eca5db CRs-Fixed: 3140750 --- core/hdd/src/wlan_hdd_main.c | 1 + core/hdd/src/wlan_hdd_power.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 0c15863672..c0378382ea 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -18313,6 +18313,7 @@ void hdd_shutdown_wlan_in_suspend(struct hdd_context *hdd_ctx) #define SHUTDOWN_IN_SUSPEND_PREVENT_TIMEOUT 5 if (!hdd_is_any_interface_open(hdd_ctx)) { + hdd_ctx->shutdown_in_suspend = true; qdf_delayed_work_start(&hdd_ctx->psoc_idle_timeout_work, SHUTDOWN_IN_SUSPEND_WAIT_TIMEOUT); hdd_prevent_suspend_timeout(SHUTDOWN_IN_SUSPEND_PREVENT_TIMEOUT, diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index b5da92f1f7..93afc934c1 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2500,8 +2500,10 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, } if (suspend_mode == PMO_SUSPEND_SHUTDOWN) { + if (hdd_ctx->shutdown_in_suspend) + return -EAGAIN; + hdd_info_rl("Shutdown WLAN in Suspend"); - hdd_ctx->shutdown_in_suspend = true; hdd_shutdown_wlan_in_suspend(hdd_ctx); /* shutdown must be excute in active, so return -EAGAIN * to PM to exit and try again