Fix for the pmcState messed up during TDLS setup

Change the device state to FULL_POWER defore sending discovery
request and if the discovery request is followed by TDLS setup
then remain in FULL_POWER mode otherwise put the device into
BMPS as soon as discovery response is received or discovery
response timeout is happened.
Change the value of discover response timeout to one sec less
than the update peer timer.
Check for the TDLS connection everytime before entering into
BMPS state when pmc traffic timer expired.

CRs-Fixed: 464212
Change-Id: Iddd7d84d0c3d1a3bcc862d2802cd323daca64df0
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 56b5281..4891e9e 100755
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -2725,7 +2725,7 @@
         return -EBUSY;
     }
 
-    if (wlan_hdd_tdls_is_progress(pAdapter, mac, TRUE))
+    if ((0 == update) && wlan_hdd_tdls_is_progress(pAdapter, mac, FALSE))
     {
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                    "%s: " MAC_ADDRESS_STR
@@ -6977,10 +6977,13 @@
 
                 if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status)
                 {
+                    wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_CONNECTED);
                     /* start TDLS client registration with TL */
                     status = hdd_roamRegisterTDLSSTA( pAdapter, peer, pTdlsPeer->staId, pTdlsPeer->signature);
-                    wlan_hdd_tdls_increment_peer_count(pAdapter);
-                    wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, eTDLS_LINK_CONNECTED);
+                    if (VOS_STATUS_SUCCESS == status)
+                    {
+                        wlan_hdd_tdls_increment_peer_count(pAdapter);
+                    }
                     wlan_hdd_tdls_check_bmps(pAdapter);
                 }