From 2b22e003f9e5099633f71bbba177ff6f09d397d7 Mon Sep 17 00:00:00 2001 From: Yu Ouyang Date: Thu, 21 Jul 2022 20:13:20 +0800 Subject: [PATCH] qcacld-3.0: Ignore wiphy_suspend if shutdown_suspend enabled If shutdown_suspend mode enabled, idle shutdown should be done before suspend enter (wihpy_suspend). However, idle shutdow (cnss_idle_shutdown) may return zero even failed to shutdown. Because cnss_idle_shutdown just post event, and then return, almost always return zero. Once this happened, driver can't be disabled. Function wiphy_suspend and wlan_hdd_cfg80211_suspend_wlan will be called. It is not expected. So, ignore wiphy_suspend if shutdown_suspend enabled, return EINVAL directly. Change-Id: I156a0bbefabe0e02ecdbe7ae37477b716840a0d4 CRs-Fixed: 3240745 --- core/hdd/src/wlan_hdd_power.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index bcc5b88e53..9f12020b13 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2434,6 +2434,7 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, struct hdd_adapter *adapter, *next_adapter = NULL; mac_handle_t mac_handle; struct wlan_objmgr_vdev *vdev; + enum pmo_suspend_mode mode; int rc; wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CFG80211_SUSPEND_WLAN; struct hdd_hostapd_state *hapd_state; @@ -2460,16 +2461,20 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, return rc; } - if (ucfg_pmo_get_suspend_mode(hdd_ctx->psoc) == PMO_SUSPEND_NONE) { - hdd_info_rl("Suspend is not supported"); - return -EINVAL; - } - if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) { hdd_debug("Driver Modules not Enabled "); return 0; } + mode = ucfg_pmo_get_suspend_mode(hdd_ctx->psoc); + if (mode == PMO_SUSPEND_NONE) { + hdd_info_rl("Suspend is not supported"); + return -EINVAL; + } else if (mode == PMO_SUSPEND_SHUTDOWN) { + hdd_info_rl("shutdown suspend should complete in prepare"); + return -EINVAL; + } + mac_handle = hdd_ctx->mac_handle; /* If RADAR detection is in progress (HDD), prevent suspend. The flag