Wlan:Check if STA/CLI is Associated before checking for authenticated

In wlan_hdd_enter_bmps if mode is auto, driver checks if the
stacontext is in authenticated state and ignore enter BMPS if
it is not authenticated.

As BMPS state is global, to avoid multiple BMPS entry, in
hdd_suspend_wlan, driver loop for adapters and only check for first
valid adapter to enter BMPS.
Now if STA is in diconnected state and P2P is in connected,
hdd_suspend_wlan check only STA adapter to enter BMPS and fails as
it is not authenticated.

To avoid this check if connection state is Associated before checking
authenticated state.

Change-Id: I49c69d31d8eff9c40c40025b3e24dd8d577acfa5
CRs-Fixed: 929357
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index 435e01e..0070993 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -3916,11 +3916,20 @@
    }
    else if (DRIVER_POWER_MODE_AUTO == mode)
    {
-       if (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)
+       /* If this is called by hdd_suspend_wlan or hdd_resume_wlan, driver
+        * was already in BMPS state and thus either STA or P2P-CLI is in
+        * associated state and authenticated, so even if STA connState is
+        * not associated it can be assumed that P2P-CLI is associated and
+        * authenticated. Thus driver can enter BMPS. And even if we try to enter
+        * BMPS with no adaptor in associated state, pmcRequestBmps will check
+        * if all condition are satisfied for entering BMPS.
+        */
+       if ((eConnectionState_Associated  == pHddStaCtx->conn_info.connState) &&
+           (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated))
        {
-           hddLog(VOS_TRACE_LEVEL_ERROR,
-                   "%s:station is in still not Authenticated ignore the "
-                   "power save mode", __func__);
+           hddLog(LOGE,
+              FL("Station is associated but, still not Authenticated ignore "
+               "power save mode"));
            return VOS_STATUS_E_AGAIN;
        }