wlan: Fix for APPS going into suspend immediatly after driver gets connect request after scan.

Acquire wakelock to handle the case where APP's tries to suspend
immediatly after the driver gets connect request(i.e after scan) from
supplicant, this result in app's is suspending and not able to process
the connect request to AP.

Change-Id: I2419ed396b5e34a6a414db87c10f47ef1e69070f
CR-Fixed: 404528
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 2430cc9..e3bbfa8 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -971,6 +971,7 @@
 void wlan_hdd_reset_prob_rspies(hdd_adapter_t* pHostapdAdapter);
 void hdd_prevent_suspend(void);
 void hdd_allow_suspend(void);
+void hdd_allow_suspend_timeout(v_U32_t timeout);
 v_U8_t hdd_is_ssr_required(void);
 void hdd_set_ssr_required(v_U8_t value);
 
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 58abfee..03dddae 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -3573,6 +3573,12 @@
     /* release the wake lock at the end of the scan*/
     hdd_allow_suspend();
 
+    /* Acquire wakelock to handle the case where APP's tries to suspend
+     * immediatly after the driver gets connect request(i.e after scan)
+     * from supplicant, this result in app's is suspending and not able
+     * to process the connect request to AP */
+    hdd_allow_suspend_timeout(100);
+
     EXIT();
     return 0;
 }
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index b369ce5..8c15812 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -3163,6 +3163,15 @@
 #endif
 }
 
+void hdd_allow_suspend_timeout(v_U32_t timeout)
+{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,5))
+    wake_lock_timeout(&wlan_wake_lock, timeout);
+#else
+    /* Do nothing as there is no API in wcnss for timeout*/
+#endif
+}
+
 /**---------------------------------------------------------------------------
 
   \brief hdd_wlan_startup() - HDD init function