Browse Source

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
Yu Ouyang 2 years ago
parent
commit
2b22e003f9
1 changed files with 10 additions and 5 deletions
  1. 10 5
      core/hdd/src/wlan_hdd_power.c

+ 10 - 5
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