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/inc/wlan_hdd_tdls.h b/CORE/HDD/inc/wlan_hdd_tdls.h
index 45ce039..7b2d753 100644
--- a/CORE/HDD/inc/wlan_hdd_tdls.h
+++ b/CORE/HDD/inc/wlan_hdd_tdls.h
@@ -44,7 +44,9 @@
 
 #define TDLS_RSSI_TRIGGER_HYSTERESIS 50
 
-#define TDLS_DISCOVERY_TIMEOUT       1000
+/* before UpdateTimer expires, we want to timeout discovery response.
+should not be more than 2000 */
+#define TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE     1000
 
 typedef struct
 {
@@ -195,4 +197,8 @@
 
 void wlan_hdd_tdls_pre_setup(tdlsCtx_t *pHddTdlsCtx, hddTdlsPeer_t *curr_peer);
 
+tANI_U32 wlan_hdd_tdls_discovery_sent_cnt(hdd_context_t *pHddCtx);
+
+void wlan_hdd_tdls_set_power_save_prohibited(hdd_adapter_t *pAdapter);
+
 #endif // __HDD_TDSL_H
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);
                 }
 
diff --git a/CORE/HDD/src/wlan_hdd_tdls.c b/CORE/HDD/src/wlan_hdd_tdls.c
index bf69952..2b3f31d 100644
--- a/CORE/HDD/src/wlan_hdd_tdls.c
+++ b/CORE/HDD/src/wlan_hdd_tdls.c
@@ -384,12 +384,7 @@
 
                         if (++curr_peer->discovery_attempt <
                                  pHddTdlsCtx->threshold_config.discovery_tries_n) {
-
-                            sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter),
-                                                  pHddTdlsCtx->pAdapter->sessionId,
-                                                  curr_peer->peerMac,
-                                                  WLAN_TDLS_DISCOVERY_REQUEST,
-                                                  1, 0, NULL, 0, 0);
+                            wlan_hdd_tdls_pre_setup(pHddTdlsCtx, curr_peer);
                         }
                         else
                         {
@@ -442,13 +437,45 @@
 
 static v_VOID_t wlan_hdd_tdls_discovery_timeout_peer_cb(v_PVOID_t userData)
 {
+    int i;
+    struct list_head *head;
+    hddTdlsPeer_t *tmp;
+    struct list_head *pos, *q;
     tdlsCtx_t *pHddTdlsCtx;
 
+    if (mutex_lock_interruptible(&tdls_lock))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                  "%s: unable to lock list", __func__);
+        return ;
+    }
     pHddTdlsCtx = (tdlsCtx_t *)userData;
-    if (NULL == pHddTdlsCtx)
-        return;
+
+    if ( NULL == pHddTdlsCtx )
+    {
+        mutex_unlock(&tdls_lock);
+        return ;
+    }
+
+    for (i = 0; i < 256; i++) {
+        head = &pHddTdlsCtx->peer_list[i];
+        list_for_each_safe (pos, q, head) {
+            tmp = list_entry(pos, hddTdlsPeer_t, node);
+            if (eTDLS_LINK_DISCOVERING == tmp->link_status)
+            {
+                VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
+                           "%s: " MAC_ADDRESS_STR " to idle state", __func__,
+                           MAC_ADDR_ARRAY(tmp->peerMac));
+                tmp->link_status = eTDLS_LINK_IDLE;
+            }
+        }
+    }
 
     pHddTdlsCtx->discovery_sent_cnt = 0;
+    wlan_hdd_tdls_set_power_save_prohibited(pHddTdlsCtx->pAdapter);
+
+    mutex_unlock(&tdls_lock);
+
     wlan_hdd_tdls_check_bmps(pHddTdlsCtx->pAdapter);
 
     return;
@@ -506,6 +533,7 @@
 
     /* initialize TDLS global context */
     pHddCtx->connected_peer_count = 0;
+    sme_SetTdlsPowerSaveProhibited(WLAN_HDD_GET_HAL_CTX(pAdapter), 0);
 
     for (staIdx = 0; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++)
     {
@@ -771,9 +799,11 @@
     if (pHddTdlsCtx->discovery_sent_cnt)
         pHddTdlsCtx->discovery_sent_cnt--;
 
+    wlan_hdd_tdls_set_power_save_prohibited(pAdapter);
     if (0 == pHddTdlsCtx->discovery_sent_cnt)
+    {
         vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer);
-    wlan_hdd_tdls_check_bmps(pAdapter);
+    }
 
     VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
                "Discovery(%lu) Response from " MAC_ADDRESS_STR " link_status %d",
@@ -790,6 +820,10 @@
                                    GFP_KERNEL);
         curr_peer->link_status = eTDLS_LINK_DISCOVERED;
     }
+    else
+    {
+        wlan_hdd_tdls_check_bmps(pAdapter);
+    }
 
     curr_peer->tdls_support = eTDLS_CAP_SUPPORTED;
     return 0;
@@ -1247,6 +1281,7 @@
     {
        wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx);
        pHddTdlsCtx->discovery_sent_cnt = 0;
+       wlan_hdd_tdls_set_power_save_prohibited(pHddTdlsCtx->pAdapter);
 
 #ifdef FEATURE_WLAN_TDLS_INTERNAL
        vos_timer_start(&pHddTdlsCtx->peerDiscoverTimer,
@@ -1275,6 +1310,8 @@
         mutex_unlock(&tdls_lock);
         return;
     }
+    pHddTdlsCtx->discovery_sent_cnt = 0;
+    wlan_hdd_tdls_set_power_save_prohibited(pHddTdlsCtx->pAdapter);
 
     wlan_hdd_tdls_timers_stop(pHddTdlsCtx);
     wlan_hdd_tdls_free_list(pHddTdlsCtx);
@@ -1297,6 +1334,10 @@
     if (NULL == pHddCtx) return;
 
     pHddCtx->connected_peer_count++;
+    wlan_hdd_tdls_set_power_save_prohibited(pAdapter);
+
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: %d",
+               __func__, pHddCtx->connected_peer_count);
 }
 
 void wlan_hdd_tdls_decrement_peer_count(hdd_adapter_t *pAdapter)
@@ -1307,6 +1348,11 @@
 
     if (pHddCtx->connected_peer_count)
         pHddCtx->connected_peer_count--;
+    wlan_hdd_tdls_set_power_save_prohibited(pAdapter);
+
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: %d",
+               __func__, pHddCtx->connected_peer_count);
+
 }
 
 void wlan_hdd_tdls_check_bmps(hdd_adapter_t *pAdapter)
@@ -1322,7 +1368,8 @@
         if (FALSE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter)))
         {
             VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
-                       "No TDLS peer connected/discovery sent. Enable BMPS");
+                       "%s: No TDLS peer connected/discovery sent. Enable BMPS",
+                       __func__);
             hdd_enable_bmps_imps(pHddCtx);
         }
     }
@@ -1330,7 +1377,8 @@
     {
         if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter)))
         {
-            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"TDLS peer connected. Disable BMPS");
+            VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,
+                       "%s: TDLS peer connected. Disable BMPS", __func__);
             hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
         }
     }
@@ -1407,6 +1455,8 @@
     wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx);
     pHddTdlsCtx->discovery_sent_cnt = 0;
     wlan_tdd_tdls_reset_tx_rx(pHddTdlsCtx);
+    wlan_hdd_tdls_set_power_save_prohibited(pHddTdlsCtx->pAdapter);
+
 
 #ifdef FEATURE_WLAN_TDLS_INTERNAL
     vos_timer_start(&pHddTdlsCtx->peerDiscoverTimer,
@@ -1454,19 +1504,72 @@
 
     if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter)))
     {
+        VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL,"%s: Disable BMPS", __func__);
         hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
     }
-    curr_peer->link_status = eTDLS_LINK_DISCOVERING;
+
+    if (eTDLS_CAP_UNKNOWN != curr_peer->tdls_support)
+        curr_peer->link_status = eTDLS_LINK_DISCOVERING;
+
     sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter),
                           pHddTdlsCtx->pAdapter->sessionId,
                           curr_peer->peerMac,
                           WLAN_TDLS_DISCOVERY_REQUEST,
                           1, 0, NULL, 0, 0);
     pHddTdlsCtx->discovery_sent_cnt++;
-    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: discovery count %lu",
-               __func__, pHddTdlsCtx->discovery_sent_cnt);
+    wlan_hdd_tdls_set_power_save_prohibited(pHddTdlsCtx->pAdapter);
+    VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, "%s: discovery count %lu timeout %lu msec",
+               __func__, pHddTdlsCtx->discovery_sent_cnt,
+               pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE);
     vos_timer_stop(&pHddTdlsCtx->peerDiscoveryTimeoutTimer);
-    vos_timer_start(&pHddTdlsCtx->peerDiscoveryTimeoutTimer, TDLS_DISCOVERY_TIMEOUT);
+    vos_timer_start(&pHddTdlsCtx->peerDiscoveryTimeoutTimer,
+        pHddTdlsCtx->threshold_config.tx_period_t - TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE);
 
     return;
 }
+
+tANI_U32 wlan_hdd_tdls_discovery_sent_cnt(hdd_context_t *pHddCtx)
+{
+    hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
+    hdd_adapter_t *pAdapter = NULL;
+    tdlsCtx_t *pHddTdlsCtx = NULL;
+    VOS_STATUS status = 0;
+    tANI_U32 count = 0;
+
+    status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode );
+    while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status )
+    {
+        pAdapter = pAdapterNode->pAdapter;
+
+        if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
+            (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode))
+        {
+            pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
+            if (NULL != pHddTdlsCtx)
+            {
+                count = count + pHddTdlsCtx->discovery_sent_cnt;
+            }
+        }
+        status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
+        pAdapterNode = pNext;
+    }
+    return count;
+}
+
+void wlan_hdd_tdls_set_power_save_prohibited(hdd_adapter_t *pAdapter)
+{
+    tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
+    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+    if ((NULL == pHddTdlsCtx) || (NULL == pHddCtx))
+        return;
+
+    if ((0 == pHddCtx->connected_peer_count) &&
+        (0 == wlan_hdd_tdls_discovery_sent_cnt(pHddCtx)))
+    {
+        sme_SetTdlsPowerSaveProhibited(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter), 0);
+        return;
+    }
+    sme_SetTdlsPowerSaveProhibited(WLAN_HDD_GET_HAL_CTX(pHddTdlsCtx->pAdapter), 1);
+    return;
+}
diff --git a/CORE/MAC/inc/aniGlobal.h b/CORE/MAC/inc/aniGlobal.h
index 75c7156..d82e905 100644
--- a/CORE/MAC/inc/aniGlobal.h
+++ b/CORE/MAC/inc/aniGlobal.h
@@ -1036,6 +1036,9 @@
     /* Instead of static allocation I will dyanamically allocate memory for dumpTableEntry
         Thinking of using linkedlist  */ 
     tDumpModuleEntry *dumpTableEntry[MAX_DUMP_TABLE_ENTRY];
+#ifdef FEATURE_WLAN_TDLS
+    v_BOOL_t isTdlsPowerSaveProhibited;
+#endif
     
 } tAniSirGlobal;
 
diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h
index e804f20..81e0f76 100644
--- a/CORE/SME/inc/sme_Api.h
+++ b/CORE/SME/inc/sme_Api.h
@@ -2530,6 +2530,13 @@
     \- return v_BOOL_t
     -------------------------------------------------------------------------*/
 v_BOOL_t sme_IsPmcBmps(tHalHandle hHal);
+/* ---------------------------------------------------------------------------
+    \fn sme_SetTdlsPowerSaveProhibited
+    \API to set/reset the isTdlsPowerSaveProhibited.
+
+    \- return void
+    -------------------------------------------------------------------------*/
+void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val);
 #endif
 #ifdef FEATURE_WLAN_TDLS_INTERNAL
 typedef struct smeTdlsDisResult
diff --git a/CORE/SME/src/pmc/pmc.c b/CORE/SME/src/pmc/pmc.c
index 95a0ad9..c9a58e0 100644
--- a/CORE/SME/src/pmc/pmc.c
+++ b/CORE/SME/src/pmc/pmc.c
@@ -18,26 +18,6 @@
  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  * PERFORMANCE OF THIS SOFTWARE.
  */
-/*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
- *
- * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
 
 /******************************************************************************
 *
@@ -46,8 +26,8 @@
 * Description:
       Power Management Control (PMC) processing routines.
 *
-* Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
-*     Qualcomm Confidential and Proprietary.
+* Copyright 2008 (c) Qualcomm Technologies, Inc. All Rights Reserved.
+*     Qualcomm Technologies Confidential and Proprietary.
 *
 *
 ******************************************************************************/
@@ -86,7 +66,7 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, FL("Entering pmcEnterLowPowerState\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcEnterLowPowerState"));
 
     /* If already in Low Power State, just return. */
     if (pMac->pmc.pmcState == LOW_POWER)
@@ -95,7 +75,7 @@
     /* Cancel any running timers. */
     if (palTimerStop(pMac->hHdd, pMac->pmc.hImpsTimer) != eHAL_STATUS_SUCCESS)
     {
-        smsLog(pMac, LOGE, FL("Cannot cancel IMPS timer\n"));
+        smsLog(pMac, LOGE, FL("Cannot cancel IMPS timer"));
         return eHAL_STATUS_FAILURE;
     }
 
@@ -103,7 +83,7 @@
 
     if (palTimerStop(pMac->hHdd, pMac->pmc.hExitPowerSaveTimer) != eHAL_STATUS_SUCCESS)
     {
-        smsLog(pMac, LOGE, FL("Cannot cancel exit power save mode timer\n"));
+        smsLog(pMac, LOGE, FL("Cannot cancel exit power save mode timer"));
         return eHAL_STATUS_FAILURE;
     }
 
@@ -136,12 +116,12 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, FL("Entering pmcExitLowPowerState\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcExitLowPowerState"));
 
     /* Must be in Low Power State if we are going to exit that state. */
     if (pMac->pmc.pmcState != LOW_POWER)
     {
-        smsLog(pMac, LOGE, FL("Cannot exit Low Power State if not in that state\n"));
+        smsLog(pMac, LOGE, FL("Cannot exit Low Power State if not in that state"));
         return eHAL_STATUS_FAILURE;
     }
 
@@ -180,7 +160,7 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, FL("Entering pmcEnterFullPowerState\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcEnterFullPowerState"));
 
     /* Take action based on the current state. */
     switch (pMac->pmc.pmcState)
@@ -216,16 +196,16 @@
 
     /* Cannot go directly to Full Power State from these states. */
     default:
-        smsLog(pMac, LOGE, FL("Trying to enter Full Power State from state %d\n"), pMac->pmc.pmcState);
+        smsLog(pMac, LOGE, FL("Trying to enter Full Power State from state %d"), pMac->pmc.pmcState);
         PMC_ABORT;
         return eHAL_STATUS_FAILURE;
     }
 
-    smsLog(pMac, LOG1, "PMC: Enter full power done: Cancel XO Core ON vote\n");
+    smsLog(pMac, LOG1, "PMC: Enter full power done: Cancel XO Core ON vote");
     if (vos_chipVoteXOCore(NULL, NULL, NULL, VOS_FALSE) != VOS_STATUS_SUCCESS)
     {
         smsLog(pMac, LOGE, "Could not cancel XO Core ON vote. Not returning failure. "
-                                "Power consumed will be high\n");
+                                "Power consumed will be high");
     }
 
     return eHAL_STATUS_SUCCESS;
@@ -254,7 +234,7 @@
     vos_call_status_type callType;
     VOS_STATUS status;
 
-    smsLog(pMac, LOG2, FL("Entering pmcEnterRequestFullPowerState\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcEnterRequestFullPowerState"));
 
     /* Take action based on the current state of the device. */
     switch (pMac->pmc.pmcState)
@@ -262,12 +242,12 @@
 
     /* Should not request full power if already there. */
     case FULL_POWER:
-        smsLog(pMac, LOGE, FL("Requesting Full Power State when already there\n"));
+        smsLog(pMac, LOGE, FL("Requesting Full Power State when already there"));
         return eHAL_STATUS_FAILURE;
 
     /* Only power events can take device out of Low Power State. */
     case LOW_POWER:
-        smsLog(pMac, LOGE, FL("Cannot request exit from Low Power State\n"));
+        smsLog(pMac, LOGE, FL("Cannot request exit from Low Power State"));
         return eHAL_STATUS_FAILURE;
 
     /* Cannot go directly to Request Full Power state from these states.
@@ -280,7 +260,7 @@
     case REQUEST_ENTER_WOWL:
     case REQUEST_EXIT_WOWL:
         smsLog(pMac, LOGW, FL("Request for full power is being buffered. "
-            "Current state is %d\n"), pMac->pmc.pmcState);
+            "Current state is %d"), pMac->pmc.pmcState);
         //Ignore the new reason if request for full power is already pending
         if( !pMac->pmc.requestFullPowerPending )
         {
@@ -347,7 +327,7 @@
             eHAL_STATUS_SUCCESS)
         {
             smsLog(pMac, LOGE, "PMC: failure to send message "
-            "eWNI_PMC_EXIT_IMPS_REQ\n");
+            "eWNI_PMC_EXIT_IMPS_REQ");
             return eHAL_STATUS_FAILURE;
         }
 
@@ -360,7 +340,7 @@
             eHAL_STATUS_SUCCESS)
         {
             smsLog(pMac, LOGE, "PMC: failure to send message "
-            "eWNI_PMC_EXIT_UAPSD_REQ\n");
+            "eWNI_PMC_EXIT_UAPSD_REQ");
             return eHAL_STATUS_FAILURE;
         }
         return eHAL_STATUS_SUCCESS;
@@ -371,14 +351,14 @@
             eHAL_STATUS_SUCCESS)
         {
             smsLog(pMac, LOGP, "PMC: failure to send message "
-            "eWNI_PMC_EXIT_WOWL_REQ\n");
+            "eWNI_PMC_EXIT_WOWL_REQ");
             return eHAL_STATUS_FAILURE;
         }
         return eHAL_STATUS_SUCCESS;
 
     /* Cannot go directly to Request Full Power State from these states. */
     default:
-        smsLog(pMac, LOGE, FL("Trying to enter Request Full Power State from state %d\n"), pMac->pmc.pmcState);
+        smsLog(pMac, LOGE, FL("Trying to enter Request Full Power State from state %d"), pMac->pmc.pmcState);
         PMC_ABORT;
         return eHAL_STATUS_FAILURE;
     }
@@ -404,12 +384,12 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, FL("Entering pmcEnterRequestImpsState\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcEnterRequestImpsState"));
 
     /* Can enter Request IMPS State only from Full Power State. */
     if (pMac->pmc.pmcState != FULL_POWER)
     {
-        smsLog(pMac, LOGE, FL("Trying to enter Request IMPS State from state %d\n"), pMac->pmc.pmcState);
+        smsLog(pMac, LOGE, FL("Trying to enter Request IMPS State from state %d"), pMac->pmc.pmcState);
         return eHAL_STATUS_FAILURE;
     }
 
@@ -419,14 +399,14 @@
     /* Tell MAC to have device enter IMPS mode. */
     if (pmcIssueCommand(hHal, eSmeCommandEnterImps, NULL, 0, FALSE) != eHAL_STATUS_SUCCESS)
     {
-        smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_IMPS_REQ\n");
+        smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_IMPS_REQ");
         pMac->pmc.pmcState = FULL_POWER;
         if(pmcShouldBmpsTimerRun(pMac))
             (void)pmcStartTrafficTimer(hHal, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
         return eHAL_STATUS_FAILURE;
      }
 
-    smsLog(pMac, LOG2, FL("eWNI_PMC_ENTER_IMPS_REQ sent to PE\n"));
+    smsLog(pMac, LOG2, FL("eWNI_PMC_ENTER_IMPS_REQ sent to PE"));
 
     return eHAL_STATUS_SUCCESS;
 }
@@ -452,12 +432,12 @@
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
     vos_call_status_type callType;
     VOS_STATUS status;
-    smsLog(pMac, LOG2, FL("Entering pmcEnterImpsState\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcEnterImpsState"));
 
     /* Can enter IMPS State only from Request IMPS State. */
     if (pMac->pmc.pmcState != REQUEST_IMPS)
     {
-        smsLog(pMac, LOGE, FL("Trying to enter IMPS State from state %d\n"), pMac->pmc.pmcState);
+        smsLog(pMac, LOGE, FL("Trying to enter IMPS State from state %d"), pMac->pmc.pmcState);
         return eHAL_STATUS_FAILURE;
     }
 
@@ -478,7 +458,7 @@
     {
         if (palTimerStart(pMac->hHdd, pMac->pmc.hImpsTimer, pMac->pmc.impsPeriod * 1000, FALSE) != eHAL_STATUS_SUCCESS)
         {
-            smsLog(pMac, LOGE, FL("Cannot start IMPS timer\n"));
+            smsLog(pMac, LOGE, FL("Cannot start IMPS timer"));
             PMC_ABORT;
             pmcEnterRequestFullPowerState(hHal, eSME_REASON_OTHER);
             return eHAL_STATUS_FAILURE;
@@ -518,12 +498,12 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, FL("Entering pmcEnterRequestBmpsState\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcEnterRequestBmpsState"));
 
     /* Can enter Request BMPS State only from Full Power State. */
     if (pMac->pmc.pmcState != FULL_POWER)
     {
-        smsLog(pMac, LOGE, FL("Trying to enter Request BMPS State from state %d\n"), pMac->pmc.pmcState);
+        smsLog(pMac, LOGE, FL("Trying to enter Request BMPS State from state %d"), pMac->pmc.pmcState);
         return eHAL_STATUS_FAILURE;
     }
 
@@ -537,7 +517,7 @@
         pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_TRUE;
         if(pmcIssueCommand(hHal, eSmeCommandEnterBmps, NULL, 0, FALSE) != eHAL_STATUS_SUCCESS)
         {
-            smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_BMPS_REQ\n");
+            smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_BMPS_REQ");
             pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_FALSE;
             pMac->pmc.pmcState = FULL_POWER;
             if(pmcShouldBmpsTimerRun(pMac))
@@ -549,7 +529,7 @@
     }
     else
     {
-        smsLog(pMac, LOGE, "PMC: enter BMPS command already queued\n");
+        smsLog(pMac, LOGE, "PMC: enter BMPS command already queued");
         //restart the timer if needed
         if(pmcShouldBmpsTimerRun(pMac))
         {
@@ -558,7 +538,7 @@
         return eHAL_STATUS_SUCCESS;
     }
 
-    smsLog(pMac, LOGW, FL("eWNI_PMC_ENTER_BMPS_REQ sent to PE\n"));
+    smsLog(pMac, LOGW, FL("eWNI_PMC_ENTER_BMPS_REQ sent to PE"));
 
     return eHAL_STATUS_SUCCESS;
 }
@@ -583,7 +563,7 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, FL("Entering pmcEnterBmpsState\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcEnterBmpsState"));
 
     /* Can enter BMPS State only from 5 states. */
     if (pMac->pmc.pmcState != REQUEST_BMPS &&
@@ -592,7 +572,7 @@
         pMac->pmc.pmcState != REQUEST_ENTER_WOWL &&
         pMac->pmc.pmcState != REQUEST_EXIT_WOWL)
     {
-        smsLog(pMac, LOGE, FL("Trying to enter BMPS State from state %d\n"), pMac->pmc.pmcState);
+        smsLog(pMac, LOGE, FL("Trying to enter BMPS State from state %d"), pMac->pmc.pmcState);
         return eHAL_STATUS_FAILURE;
     }
 
@@ -610,7 +590,7 @@
 
         /* Start exit BMPS sequence now. */
         smsLog(pMac, LOGW, FL("Pending Full Power request found on entering BMPS mode. "
-                  "Start exit BMPS exit sequence\n"));
+                  "Start exit BMPS exit sequence"));
         //Note: Reason must have been set when requestFullPowerPending flag was set.
         pmcEnterRequestFullPowerState(hHal, pMac->pmc.requestFullPowerReason);
         return eHAL_STATUS_SUCCESS;
@@ -620,14 +600,14 @@
     if (pMac->pmc.wowlModeRequired && pMac->pmc.uapsdSessionRequired)
     {
         smsLog(pMac, LOGW, FL("Both UAPSD and WOWL is required on entering BMPS mode. "
-               "UAPSD will be prioritized over WOWL\n"));
+               "UAPSD will be prioritized over WOWL"));
     }
 
     /* Do we need Uapsd?*/
     if (pMac->pmc.uapsdSessionRequired)
     {
         smsLog(pMac, LOGW, FL("UAPSD session is required on entering BMPS mode. "
-                  "Start UAPSD entry sequence\n"));
+                  "Start UAPSD entry sequence"));
         pmcEnterRequestStartUapsdState(hHal);
         return eHAL_STATUS_SUCCESS;
     }
@@ -636,7 +616,7 @@
     if (pMac->pmc.wowlModeRequired)
     {
         smsLog(pMac, LOGW, FL("WOWL is required on entering BMPS mode. "
-                  "Start WOWL entry sequence\n"));
+                  "Start WOWL entry sequence"));
         pmcRequestEnterWowlState(hHal, &(pMac->pmc.wowlEnterParams));
     }
 
@@ -667,7 +647,7 @@
     tANI_BOOLEAN (*checkRoutine) (void *checkContext);
     tANI_BOOLEAN bResult=FALSE;
 
-    smsLog(pMac, LOG2, FL("Entering pmcPowerSaveCheck\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcPowerSaveCheck"));
 
     /* Call the routines in the power save check routine list.  If any
        return FALSE, then we cannot go into power save mode. */
@@ -683,7 +663,7 @@
         {
             if (!checkRoutine(pPowerSaveCheckEntry->checkContext))
             {
-                smsLog(pMac, LOGE, FL("pmcPowerSaveCheck fail!\n"));
+                smsLog(pMac, LOGE, FL("pmcPowerSaveCheck fail!"));
                 bResult = FALSE;
                 break;
             }
@@ -719,7 +699,7 @@
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
     tSirPowerSaveCfg powerSaveConfig;
 
-    smsLog(pMac, LOG2, FL("Entering pmcSendPowerSaveConfigMessage\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcSendPowerSaveConfigMessage"));
 
     palZeroMemory(pMac->hHdd, &(powerSaveConfig), sizeof(tSirPowerSaveCfg));
 
@@ -780,7 +760,7 @@
     if (pmcSendMessage(hHal, eWNI_PMC_PWR_SAVE_CFG, &powerSaveConfig, sizeof(tSirPowerSaveCfg))
         != eHAL_STATUS_SUCCESS)
     {
-        smsLog(pMac, LOGE, FL("Send of eWNI_PMC_PWR_SAVE_CFG to PE failed\n"));
+        smsLog(pMac, LOGE, FL("Send of eWNI_PMC_PWR_SAVE_CFG to PE failed"));
         return eHAL_STATUS_FAILURE;
     }
 
@@ -810,12 +790,12 @@
 {
     tSirMbMsg *pMsg;
 
-    smsLog(pMac, LOG2, FL("Entering pmcSendMessage, message type %d\n"), messageType);
+    smsLog(pMac, LOG2, FL("Entering pmcSendMessage, message type %d"), messageType);
 
     /* Allocate and fill in message. */
     if (palAllocateMemory(pMac->hHdd, (void **)&pMsg, WNI_CFG_MB_HDR_LEN + messageSize) != eHAL_STATUS_SUCCESS)
     {
-        smsLog(pMac, LOGE, FL("Cannot allocate memory for message\n"));
+        smsLog(pMac, LOGE, FL("Cannot allocate memory for message"));
         PMC_ABORT;
         return eHAL_STATUS_FAILURE;
     }
@@ -825,7 +805,7 @@
     {
         if (palCopyMemory(pMac->hHdd, pMsg->data, pMessageData, messageSize) != eHAL_STATUS_SUCCESS)
         {
-            smsLog(pMac, LOGE, FL("Cannot copy message data\n"));
+            smsLog(pMac, LOGE, FL("Cannot copy message data"));
             PMC_ABORT;
             return eHAL_STATUS_FAILURE;
         }
@@ -834,7 +814,7 @@
     /* Send message. */
     if (palSendMBMessage(pMac->hHdd, pMsg) != eHAL_STATUS_SUCCESS)
     {
-        smsLog(pMac, LOGE, FL("Cannot send message\n"));
+        smsLog(pMac, LOGE, FL("Cannot send message"));
         PMC_ABORT;
         return eHAL_STATUS_FAILURE;
     }
@@ -865,7 +845,7 @@
     tListElem *pEntry;
     tpRequestFullPowerEntry pRequestFullPowerEntry;
 
-    smsLog(pMac, LOG2, FL("Entering pmcDoCallbacks\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcDoCallbacks"));
 
     /* Call IMPS callback routine. */
     if (pMac->pmc.impsCallbackRoutine != NULL)
@@ -882,7 +862,7 @@
            pRequestFullPowerEntry->callbackRoutine(pRequestFullPowerEntry->callbackContext, callbackStatus);
         if (palFreeMemory(pMac->hHdd, pRequestFullPowerEntry) != eHAL_STATUS_SUCCESS)
         {
-            smsLog(pMac, LOGE, FL("Cannot free request full power routine list entry\n"));
+            smsLog(pMac, LOGE, FL("Cannot free request full power routine list entry"));
             PMC_ABORT;
         }
     }
@@ -911,7 +891,7 @@
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
     VOS_STATUS vosStatus;
 
-    smsLog(pMac, LOG2, FL("Entering pmcStartTrafficTimer\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcStartTrafficTimer"));
 
     vosStatus = vos_timer_start(&pMac->pmc.hTrafficTimer, expirationTime);
     if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
@@ -919,11 +899,11 @@
         if( VOS_STATUS_E_ALREADY == vosStatus )
         {
             //Consider this ok since the timer is already started.
-            smsLog(pMac, LOGW, FL("  traffic timer is already started\n"));
+            smsLog(pMac, LOGW, FL("  traffic timer is already started"));
         }
         else
         {
-            smsLog(pMac, LOGP, FL("Cannot start traffic timer\n"));
+            smsLog(pMac, LOGP, FL("Cannot start traffic timer"));
             return eHAL_STATUS_FAILURE;
         }
     }
@@ -948,7 +928,7 @@
 void pmcStopTrafficTimer (tHalHandle hHal)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    smsLog(pMac, LOG2, FL("Entering pmcStopTrafficTimer\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcStopTrafficTimer"));
     vos_timer_stop(&pMac->pmc.hTrafficTimer);
 }
 
@@ -971,12 +951,12 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, FL("Entering pmcImpsTimerExpired\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcImpsTimerExpired"));
 
     /* If timer expires and we are in a state other than IMPS State then something is wrong. */
     if (pMac->pmc.pmcState != IMPS)
     {
-        smsLog(pMac, LOGE, FL("Got IMPS timer expiration in state %d\n"), pMac->pmc.pmcState);
+        smsLog(pMac, LOGE, FL("Got IMPS timer expiration in state %d"), pMac->pmc.pmcState);
         PMC_ABORT;
         return;
     }
@@ -1018,11 +998,11 @@
     /* Untill DHCP is not completed remain in power active */
     if(pMac->pmc.remainInPowerActiveTillDHCP)
     {
-        smsLog(pMac, LOG2, FL("BMPS Traffic Timer expired before DHCP completion ignore enter BMPS\n"));
+        smsLog(pMac, LOG2, FL("BMPS Traffic Timer expired before DHCP completion ignore enter BMPS"));
         pMac->pmc.remainInPowerActiveThreshold++;
         if( pMac->pmc.remainInPowerActiveThreshold >= DHCP_REMAIN_POWER_ACTIVE_THRESHOLD)
         {
-           smsLog(pMac, LOGE, FL("Remain in power active DHCP threshold reached FALLBACK to enable enter BMPS\n"));
+           smsLog(pMac, LOGE, FL("Remain in power active DHCP threshold reached FALLBACK to enable enter BMPS"));
            /*FALLBACK: reset the flag to make BMPS entry possible*/
            pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
            pMac->pmc.remainInPowerActiveThreshold = 0;
@@ -1031,7 +1011,7 @@
         vosStatus = vos_timer_start(&pMac->pmc.hTrafficTimer, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
         if ( !VOS_IS_STATUS_SUCCESS(vosStatus) && (VOS_STATUS_E_ALREADY != vosStatus) )
         {
-            smsLog(pMac, LOGP, FL("Cannot re-start traffic timer\n"));
+            smsLog(pMac, LOGP, FL("Cannot re-start traffic timer"));
         }
         return;
     }
@@ -1046,6 +1026,14 @@
         return;
     }
 
+#ifdef FEATURE_WLAN_TDLS
+    if (pMac->isTdlsPowerSaveProhibited)
+    {
+       smsLog(pMac, LOGE, FL("TDLS peer(s) connected/discovery sent. Dont enter BMPS"));
+       return;
+    }
+#endif
+
     if (pmcPowerSaveCheck(hHal))
     {
         smsLog(pMac, LOGW, FL("BMPS entry criteria satisfied. Requesting BMPS state"));
@@ -1059,7 +1047,7 @@
         vosStatus = vos_timer_start(&pMac->pmc.hTrafficTimer, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
         if ( !VOS_IS_STATUS_SUCCESS(vosStatus) && (VOS_STATUS_E_ALREADY != vosStatus) )
         {
-            smsLog(pMac, LOGP, FL("Cannot start traffic timer\n"));
+            smsLog(pMac, LOGP, FL("Cannot start traffic timer"));
             return;
         }
     }
@@ -1084,7 +1072,7 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, FL("Entering pmcExitPowerSaveTimerExpired\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcExitPowerSaveTimerExpired"));
 
     /* Make sure process of exiting power save mode might hasn't already been started due to another trigger. */
     if (pMac->pmc.requestFullPowerPending)
@@ -1115,7 +1103,7 @@
    tListElem *pEntry;
    tpRequestBmpsEntry pRequestBmpsEntry;
 
-   smsLog(pMac, LOG2, "PMC: entering pmcDoBmpsCallbacks\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcDoBmpsCallbacks");
 
    /* Call the routines in the request BMPS callback routine list. */
    pEntry = csrLLRemoveHead(&pMac->pmc.requestBmpsList, FALSE);
@@ -1155,7 +1143,7 @@
    tListElem *pEntry;
    tpStartUapsdEntry pStartUapsdEntry;
 
-   smsLog(pMac, LOG2, "PMC: entering pmcDoStartUapsdCallbacks\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcDoStartUapsdCallbacks");
 
    /* Call the routines in the request start UAPSD callback routine list. */
    pEntry = csrLLRemoveHead(&pMac->pmc.requestStartUapsdList, FALSE);
@@ -1189,7 +1177,7 @@
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
    v_BOOL_t fFullPower = VOS_FALSE;     //need to get back to full power state
 
-   smsLog(pMac, LOG2, "PMC: entering pmcEnterRequestStartUapsdState\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterRequestStartUapsdState");
 
    /* Can enter UAPSD State only from FULL_POWER or BMPS State. */
    switch (pMac->pmc.pmcState)
@@ -1199,7 +1187,7 @@
          if (!pmcPowerSaveCheck(hHal))
          {
             smsLog(pMac, LOGW, "PMC: Power save check failed. UAPSD request "
-                      "will be accepted and buffered\n");
+                      "will be accepted and buffered");
             /* UAPSD mode will be attempted when we enter BMPS later */
             pMac->pmc.uapsdSessionRequired = TRUE;
             /* Make sure the BMPS retry timer is running */
@@ -1220,7 +1208,7 @@
                if(pmcEnterRequestBmpsState(hHal) != eHAL_STATUS_SUCCESS)
                {
                    smsLog(pMac, LOGE, "PMC: Device in Full Power. Enter Request Bmps failed. "
-                            "UAPSD request will be dropped \n");
+                            "UAPSD request will be dropped ");
                   return eHAL_STATUS_FAILURE;
                }
             }
@@ -1244,7 +1232,7 @@
                eHAL_STATUS_SUCCESS)
             {
                smsLog(pMac, LOGE, "PMC: failure to send message "
-                  "eWNI_PMC_ENTER_BMPS_REQ\n");
+                  "eWNI_PMC_ENTER_BMPS_REQ");
                return eHAL_STATUS_FAILURE;
             }
          }
@@ -1252,7 +1240,7 @@
          else
          {
             //Not ready for UAPSD at this time, save it first and wake up the chip
-            smsLog(pMac, LOGE, " PMC state = %d\n",pMac->pmc.pmcState);
+            smsLog(pMac, LOGE, " PMC state = %d",pMac->pmc.pmcState);
             pMac->pmc.uapsdSessionRequired = TRUE;
             /* While BTC traffic is going on, STA can be in BMPS
              * and need not go to Full Power */
@@ -1284,7 +1272,7 @@
         break;
 
       default:
-         smsLog(pMac, LOGE, "PMC: trying to enter UAPSD State from state %d\n",
+         smsLog(pMac, LOGE, "PMC: trying to enter UAPSD State from state %d",
             pMac->pmc.pmcState);
          return eHAL_STATUS_FAILURE;
    }
@@ -1294,7 +1282,7 @@
       if( eHAL_STATUS_PMC_PENDING != pmcRequestFullPower( pMac, NULL, NULL, eSME_REASON_OTHER ) )
       {
          //This is an error
-         smsLog(pMac, LOGE, FL(" fail to request full power because BTC\n"));
+         smsLog(pMac, LOGE, FL(" fail to request full power because BTC"));
       }
    }
 
@@ -1320,12 +1308,12 @@
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-   smsLog(pMac, LOG2, "PMC: entering pmcEnterUapsdState\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterUapsdState");
 
    /* Can enter UAPSD State only from Request UAPSD State. */
    if (pMac->pmc.pmcState != REQUEST_START_UAPSD )
    {
-      smsLog(pMac, LOGE, "PMC: trying to enter UAPSD State from state %d\n",
+      smsLog(pMac, LOGE, "PMC: trying to enter UAPSD State from state %d",
       pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
@@ -1369,7 +1357,7 @@
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-   smsLog(pMac, LOG2, "PMC: entering pmcEnterRequestStopUapsdState\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterRequestStopUapsdState");
 
    /* If already in REQUEST_STOP_UAPSD, simply return */
    if (pMac->pmc.pmcState == REQUEST_STOP_UAPSD)
@@ -1381,7 +1369,7 @@
    if (pMac->pmc.pmcState != UAPSD)
    {
       smsLog(pMac, LOGE, "PMC: trying to enter Request Stop UAPSD State from "
-         "state %d\n", pMac->pmc.pmcState);
+         "state %d", pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
 
@@ -1390,7 +1378,7 @@
       eHAL_STATUS_SUCCESS)
    {
       smsLog(pMac, LOGE, "PMC: failure to send message "
-         "eWNI_PMC_EXIT_UAPSD_REQ\n");
+         "eWNI_PMC_EXIT_UAPSD_REQ");
       return eHAL_STATUS_FAILURE;
    }
 
@@ -1416,13 +1404,13 @@
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-   smsLog(pMac, LOG2, "PMC: entering pmcEnterRequestStandbyState\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterRequestStandbyState");
 
    /* Can enter Standby State only from Full Power State. */
    if (pMac->pmc.pmcState != FULL_POWER)
    {
       smsLog(pMac, LOGE, "PMC: trying to enter Standby State from "
-         "state %d\n", pMac->pmc.pmcState);
+         "state %d", pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
 
@@ -1435,7 +1423,7 @@
       eHAL_STATUS_SUCCESS)
    {
       smsLog(pMac, LOGE, "PMC: failure to send message "
-         "eWNI_PMC_ENTER_IMPS_REQ\n");
+         "eWNI_PMC_ENTER_IMPS_REQ");
       pMac->pmc.pmcState = FULL_POWER;
 
       if(pmcShouldBmpsTimerRun(pMac))
@@ -1467,12 +1455,12 @@
    vos_call_status_type callType;
    VOS_STATUS status;
 
-   smsLog(pMac, LOG2, "PMC: entering pmcEnterStandbyState\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterStandbyState");
 
    /* Can enter STANDBY State only from REQUEST_STANDBY State. */
    if (pMac->pmc.pmcState != REQUEST_STANDBY)
    {
-      smsLog(pMac, LOGE, "PMC: trying to enter STANDBY State from state %d\n",
+      smsLog(pMac, LOGE, "PMC: trying to enter STANDBY State from state %d",
          pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
@@ -1520,7 +1508,7 @@
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-   smsLog(pMac, LOG2, "PMC: entering pmcDoStandbyCallbacks\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcDoStandbyCallbacks");
 
    /* Call Standby callback routine. */
    if (pMac->pmc.standbyCallbackRoutine != NULL)
@@ -1600,7 +1588,7 @@
     void (*callbackRoutine) (void *callbackContext, tPmcState pmcState);
 
     smsLog(pMac, LOG2, FL("PMC - Update registered modules of new device "
-           "state: %s\n"), pmcGetPmcStateStr(state));
+           "state: %s"), pmcGetPmcStateStr(state));
 
     /* Call the routines in the update device state routine list. */
     pEntry = csrLLPeekHead(&pMac->pmc.deviceStateUpdateIndList, FALSE);
@@ -1631,7 +1619,7 @@
 eHalStatus pmcRequestEnterWowlState(tHalHandle hHal, tpSirSmeWowlEnterParams wowlEnterParams)
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-   smsLog(pMac, LOG2, "PMC: entering pmcRequestEnterWowlState\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcRequestEnterWowlState");
 
    switch (pMac->pmc.pmcState)
    {
@@ -1640,14 +1628,14 @@
          if(pmcEnterRequestBmpsState(hHal) != eHAL_STATUS_SUCCESS)
          {
             smsLog(pMac, LOGE, "PMC: Device in Full Power. pmcEnterRequestBmpsState failed. "
-                    "Cannot enter WOWL\n");
+                    "Cannot enter WOWL");
             return eHAL_STATUS_FAILURE;
          }
          break;
 
       case REQUEST_BMPS:
          smsLog(pMac, LOGW, "PMC: BMPS transaction going on. WOWL request "
-                    "will be buffered\n");
+                    "will be buffered");
          break;
 
       case BMPS:
@@ -1658,7 +1646,7 @@
          if (pmcIssueCommand(hHal, eSmeCommandEnterWowl, wowlEnterParams, sizeof(tSirSmeWowlEnterParams), FALSE) !=
             eHAL_STATUS_SUCCESS)
          {
-            smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ\n");
+            smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ");
             return eHAL_STATUS_FAILURE;
          }
          break;
@@ -1666,16 +1654,16 @@
       case REQUEST_ENTER_WOWL:
          //Multiple enter WOWL requests at the same time are not accepted
          smsLog(pMac, LOGE, "PMC: Enter WOWL transaction already going on. New WOWL request "
-                    "will be rejected\n");
+                    "will be rejected");
          return eHAL_STATUS_FAILURE;
 
       case REQUEST_EXIT_WOWL:
          smsLog(pMac, LOGW, "PMC: Exit WOWL transaction going on. New WOWL request "
-                   "will be buffered\n");
+                   "will be buffered");
          break;
 
       default:
-         smsLog(pMac, LOGE, "PMC: Trying to enter WOWL State from state %s\n",
+         smsLog(pMac, LOGE, "PMC: Trying to enter WOWL State from state %s",
             pmcGetPmcStateStr(pMac->pmc.pmcState));
          return eHAL_STATUS_FAILURE;
    }
@@ -1702,12 +1690,12 @@
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-   smsLog(pMac, LOG2, "PMC: entering pmcEnterWowlState\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcEnterWowlState");
 
    /* Can enter WOWL State only from Request WOWL State. */
    if (pMac->pmc.pmcState != REQUEST_ENTER_WOWL )
    {
-      smsLog(pMac, LOGP, "PMC: trying to enter WOWL State from state %d\n",
+      smsLog(pMac, LOGP, "PMC: trying to enter WOWL State from state %d",
         pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
@@ -1748,7 +1736,7 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, "PMC: entering pmcRequestExitWowlState\n");
+    smsLog(pMac, LOG2, "PMC: entering pmcRequestExitWowlState");
 
     switch (pMac->pmc.pmcState)
     {
@@ -1757,17 +1745,17 @@
             if (pmcIssueCommand(hHal, eSmeCommandExitWowl, NULL, 0, FALSE) !=
                 eHAL_STATUS_SUCCESS)
             {
-                smsLog(pMac, LOGP, "PMC: failure to send message eWNI_PMC_EXIT_WOWL_REQ\n");
+                smsLog(pMac, LOGP, "PMC: failure to send message eWNI_PMC_EXIT_WOWL_REQ");
                 return eHAL_STATUS_FAILURE;
             }
             break;
 
         case REQUEST_ENTER_WOWL:
-            smsLog(pMac, LOGP, "PMC: Rcvd exit WOWL even before enter WOWL was completed\n");
+            smsLog(pMac, LOGP, "PMC: Rcvd exit WOWL even before enter WOWL was completed");
             return eHAL_STATUS_FAILURE;
 
         default:
-            smsLog(pMac, LOGW, "PMC: Got exit WOWL in state %s. Nothing to do as already out of WOWL\n",
+            smsLog(pMac, LOGW, "PMC: Got exit WOWL in state %s. Nothing to do as already out of WOWL",
             pmcGetPmcStateStr(pMac->pmc.pmcState));
             break;
     }
@@ -1792,7 +1780,7 @@
 {
    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-   smsLog(pMac, LOG2, "PMC: entering pmcDoWowlCallbacks\n");
+   smsLog(pMac, LOG2, "PMC: entering pmcDoWowlCallbacks");
 
    /* Call Wowl callback routine. */
    if (pMac->pmc.enterWowlCallbackRoutine != NULL)
@@ -1819,7 +1807,7 @@
                     &pDeferredMsg->u.wowlAddPattern, sizeof(tSirWowlAddBcastPtrn))
                     != eHAL_STATUS_SUCCESS)
             {
-                smsLog(pMac, LOGE, FL("Send of eWNI_PMC_WOWL_ADD_BCAST_PTRN to PE failed\n"));
+                smsLog(pMac, LOGE, FL("Send of eWNI_PMC_WOWL_ADD_BCAST_PTRN to PE failed"));
             }
             break;
 
@@ -1829,7 +1817,7 @@
                     &pDeferredMsg->u.wowlDelPattern, sizeof(tSirWowlDelBcastPtrn))
                     != eHAL_STATUS_SUCCESS)
             {
-                smsLog(pMac, LOGE, FL("Send of eWNI_PMC_WOWL_ADD_BCAST_PTRN to PE failed\n"));
+                smsLog(pMac, LOGE, FL("Send of eWNI_PMC_WOWL_ADD_BCAST_PTRN to PE failed"));
             }
             break;
 
@@ -1839,12 +1827,12 @@
                     &pDeferredMsg->u.powerSaveConfig, sizeof(tSirPowerSaveCfg))
                 != eHAL_STATUS_SUCCESS)
             {
-                smsLog(pMac, LOGE, FL("Send of eWNI_PMC_PWR_SAVE_CFG to PE failed\n"));
+                smsLog(pMac, LOGE, FL("Send of eWNI_PMC_PWR_SAVE_CFG to PE failed"));
             }
             break;
 
         default:
-            smsLog(pMac, LOGE, FL("unknown message (%d)\n"), pDeferredMsg->messageType);
+            smsLog(pMac, LOGE, FL("unknown message (%d)"), pDeferredMsg->messageType);
             break;
         }
         //Need to free the memory here
@@ -1860,7 +1848,7 @@
 
     if( !HAL_STATUS_SUCCESS( palAllocateMemory( pMac->hHdd, (void **)&pDeferredMsg, sizeof(tPmcDeferredMsg) ) ) )
     {
-        smsLog(pMac, LOGE, FL("Cannot allocate memory for callback context\n"));
+        smsLog(pMac, LOGE, FL("Cannot allocate memory for callback context"));
         return eHAL_STATUS_RESOURCES;
     }
     palZeroMemory( pMac->hHdd, pDeferredMsg, sizeof(tPmcDeferredMsg) );
@@ -1871,7 +1859,7 @@
         if( !HAL_STATUS_SUCCESS( palCopyMemory( pMac->hHdd, &pDeferredMsg->u.data,
                                     pData, size ) ) )
         {
-            smsLog(pMac, LOGE, FL("Cannot copy pattern for callback context\n"));
+            smsLog(pMac, LOGE, FL("Cannot copy pattern for callback context"));
             palFreeMemory( pMac->hHdd, pDeferredMsg );
             return eHAL_STATUS_FAILURE;
         }
@@ -1889,7 +1877,7 @@
         }
         if( !HAL_STATUS_SUCCESS( status ) )
         {
-            smsLog(pMac, LOGE, FL("failed to request full power status = %d\n"), status);
+            smsLog(pMac, LOGE, FL("failed to request full power status = %d"), status);
         }
     }
 
@@ -1924,54 +1912,54 @@
             switch( pCommand->command )
             {
             case eSmeCommandEnterImps:
-                smsLog(pMac, LOGE, FL("aborting request to enter IMPS\n"));
+                smsLog(pMac, LOGE, FL("aborting request to enter IMPS"));
                 pmcEnterFullPowerState(pMac);
                 break;
 
             case eSmeCommandExitImps:
-                smsLog(pMac, LOGE, FL("aborting request to exit IMPS \n"));
+                smsLog(pMac, LOGE, FL("aborting request to exit IMPS "));
                 pmcEnterFullPowerState(pMac);
                 break;
 
             case eSmeCommandEnterBmps:
-                smsLog(pMac, LOGE, FL("aborting request to enter BMPS \n"));
+                smsLog(pMac, LOGE, FL("aborting request to enter BMPS "));
                 pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_FALSE;
                 pmcEnterFullPowerState(pMac);
                 pmcDoBmpsCallbacks(pMac, eHAL_STATUS_FAILURE);
                 break;
 
             case eSmeCommandExitBmps:
-                smsLog(pMac, LOGE, FL("aborting request to exit BMPS \n"));
+                smsLog(pMac, LOGE, FL("aborting request to exit BMPS "));
                 pmcEnterFullPowerState(pMac);
                 break;
 
             case eSmeCommandEnterUapsd:
-                smsLog(pMac, LOGE, FL("aborting request to enter UAPSD \n"));
+                smsLog(pMac, LOGE, FL("aborting request to enter UAPSD "));
                 //Since there is no retry for UAPSD, tell the requester here we are done with failure
                 pMac->pmc.uapsdSessionRequired = FALSE;
                 pmcDoStartUapsdCallbacks(pMac, eHAL_STATUS_FAILURE);
                 break;
 
             case eSmeCommandExitUapsd:
-                smsLog(pMac, LOGE, FL("aborting request to exit UAPSD \n"));
+                smsLog(pMac, LOGE, FL("aborting request to exit UAPSD "));
                 break;
 
             case eSmeCommandEnterWowl:
-                smsLog(pMac, LOGE, FL("aborting request to enter WOWL \n"));
+                smsLog(pMac, LOGE, FL("aborting request to enter WOWL "));
                 pmcDoEnterWowlCallbacks(pMac, eHAL_STATUS_FAILURE);
                 break;
 
             case eSmeCommandExitWowl:
-                smsLog(pMac, LOGE, FL("aborting request to exit WOWL \n"));
+                smsLog(pMac, LOGE, FL("aborting request to exit WOWL "));
                 break;
 
             case eSmeCommandEnterStandby:
-                smsLog(pMac, LOGE, FL("aborting request to enter Standby \n"));
+                smsLog(pMac, LOGE, FL("aborting request to enter Standby "));
                 pmcDoStandbyCallbacks(pMac, eHAL_STATUS_FAILURE);
                 break;
 
             default:
-                smsLog(pMac, LOGE, FL("Request for PMC command (%d) is dropped\n"), pCommand->command);
+                smsLog(pMac, LOGE, FL("Request for PMC command (%d) is dropped"), pCommand->command);
                 break;
             }
         }// !stopping
@@ -2062,7 +2050,7 @@
             }
             else
             {
-                smsLog( pMac, LOGE, (" exit BMPS must have a reason code\n") );
+                smsLog( pMac, LOGE, (" exit BMPS must have a reason code") );
             }
             break;
 
@@ -2075,7 +2063,7 @@
             break;
 
         default:
-            smsLog( pMac, LOGE, FL("  invalid command type %d\n"), cmdType );
+            smsLog( pMac, LOGE, FL("  invalid command type %d"), cmdType );
             status = eHAL_STATUS_INVALID_PARAMETER;
             break;
         }
@@ -2143,7 +2131,7 @@
                 }
                 if( !HAL_STATUS_SUCCESS( status ) )
                 {
-                    smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_IMPS_REQ or pmcEnterImpsCheck failed\n");
+                    smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_IMPS_REQ or pmcEnterImpsCheck failed");
                     pmcEnterFullPowerState( pMac );
                     if(pmcShouldBmpsTimerRun(pMac))
                         (void)pmcStartTrafficTimer(pMac, pMac->pmc.bmpsConfig.trafficMeasurePeriod);
@@ -2166,12 +2154,12 @@
                 if ( HAL_STATUS_SUCCESS( status ) )
                 {
                     pMac->pmc.pmcState = REQUEST_FULL_POWER;
-                    smsLog(pMac, LOG2, FL("eWNI_PMC_EXIT_IMPS_REQ sent to PE\n"));
+                    smsLog(pMac, LOG2, FL("eWNI_PMC_EXIT_IMPS_REQ sent to PE"));
                     fRemoveCmd = eANI_BOOLEAN_FALSE;
                 }
                 else
                 {
-                    smsLog(pMac, LOGE, FL("eWNI_PMC_EXIT_IMPS_REQ fail to be sent to PE status %d\n"), status);
+                    smsLog(pMac, LOGE, FL("eWNI_PMC_EXIT_IMPS_REQ fail to be sent to PE status %d"), status);
                     //Callbacks are called with success srarus, do we need to pass in real status??
                     pmcEnterFullPowerState(pMac);
                 }
@@ -2187,11 +2175,11 @@
                 {
                     /* Change PMC state */
                     pMac->pmc.pmcState = REQUEST_BMPS;
-                    smsLog(pMac, LOG2, "PMC: Enter BMPS req done: Force XO Core ON\n");
+                    smsLog(pMac, LOG2, "PMC: Enter BMPS req done: Force XO Core ON");
                     vstatus = vos_chipVoteXOCore(NULL, NULL, NULL, VOS_TRUE);
                     if ( !VOS_IS_STATUS_SUCCESS(vstatus) )
                     {
-                        smsLog(pMac, LOGE, "Could not turn XO Core ON. Can't go to BMPS\n");
+                        smsLog(pMac, LOGE, "Could not turn XO Core ON. Can't go to BMPS");
                     }
                     else /* XO Core turn ON was successful */
                     {
@@ -2203,15 +2191,15 @@
                     }
                     else
                     {
-                        smsLog(pMac, LOGE, "Fail to send enter BMPS msg to PE\n");
+                        smsLog(pMac, LOGE, "Fail to send enter BMPS msg to PE");
                             /* Cancel the vote for XO Core */
                             smsLog(pMac, LOGW, "In module init: Cancel the vote for XO CORE ON "
-                                                             "since send enter bmps failed\n");
+                                                             "since send enter bmps failed");
                             if (vos_chipVoteXOCore(NULL, NULL, NULL, VOS_FALSE) != VOS_STATUS_SUCCESS)
                             {
                                 smsLog(pMac, LOGE, "Could not cancel XO Core ON vote."
                                                    "Not returning failure."
-                                                   "Power consumed will be high\n");
+                                                   "Power consumed will be high");
                             }
 
                         }
@@ -2219,7 +2207,7 @@
                 }
                 if( !HAL_STATUS_SUCCESS( status ) )
                 {
-                    smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_BMPS_REQ status %d\n", status);
+                    smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_BMPS_REQ status %d", status);
                     pMac->pmc.bmpsRequestQueued = eANI_BOOLEAN_FALSE;
                     pmcEnterFullPowerState(pMac);
                     //Do not call UAPSD callback here since it may be retried
@@ -2241,12 +2229,12 @@
                 {
                     pMac->pmc.pmcState = REQUEST_FULL_POWER;
                     fRemoveCmd = eANI_BOOLEAN_FALSE;
-                    smsLog(pMac, LOG2, FL("eWNI_PMC_EXIT_BMPS_REQ sent to PE\n"));
+                    smsLog(pMac, LOG2, FL("eWNI_PMC_EXIT_BMPS_REQ sent to PE"));
 
                 }
                 else
                 {
-                    smsLog(pMac, LOGE, FL("eWNI_PMC_EXIT_BMPS_REQ fail to be sent to PE status %d\n"), status);
+                    smsLog(pMac, LOGE, FL("eWNI_PMC_EXIT_BMPS_REQ fail to be sent to PE status %d"), status);
                     pmcEnterFullPowerState(pMac);
                 }
             }
@@ -2265,7 +2253,7 @@
                 else
                 {
                     smsLog(pMac, LOGE, "PMC: failure to send message "
-                       "eWNI_PMC_ENTER_BMPS_REQ\n");
+                       "eWNI_PMC_ENTER_BMPS_REQ");
                     //there is no retry for re-entering UAPSD so tell the requester we are done witgh failure.
                     pMac->pmc.uapsdSessionRequired = FALSE;
                     pmcDoStartUapsdCallbacks(pMac, eHAL_STATUS_FAILURE);
@@ -2297,7 +2285,7 @@
                else
                {
                    smsLog(pMac, LOGE, "PMC: failure to send message "
-                      "eWNI_PMC_EXIT_UAPSD_REQ\n");
+                      "eWNI_PMC_EXIT_UAPSD_REQ");
                    pmcEnterBmpsState(pMac);
                }
            }
@@ -2316,7 +2304,7 @@
                 }
                 else
                 {
-                    smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ\n");
+                    smsLog(pMac, LOGE, "PMC: failure to send message eWNI_PMC_ENTER_WOWL_REQ");
                     pmcDoEnterWowlCallbacks(pMac, eHAL_STATUS_FAILURE);
                 }
             }
@@ -2340,7 +2328,7 @@
                 }
                 else
                 {
-                    smsLog(pMac, LOGP, "PMC: failure to send message eWNI_PMC_EXIT_WOWL_REQ\n");
+                    smsLog(pMac, LOGP, "PMC: failure to send message eWNI_PMC_EXIT_WOWL_REQ");
                     pmcEnterBmpsState(pMac);
                 }
             }
@@ -2384,7 +2372,7 @@
                 else
                 {
                     smsLog(pMac, LOGE, "PMC: failure to send message "
-                        "eWNI_PMC_ENTER_IMPS_REQ\n");
+                        "eWNI_PMC_ENTER_IMPS_REQ");
                     pmcEnterFullPowerState(pMac);
                     pmcDoStandbyCallbacks(pMac, eHAL_STATUS_FAILURE);
                     /* Start the timer only if Auto BMPS feature is enabled or an UAPSD session is
@@ -2396,7 +2384,7 @@
             break;
 
         default:
-            smsLog( pMac, LOGE, FL("  invalid command type %d\n"), pCommand->command );
+            smsLog( pMac, LOGE, FL("  invalid command type %d"), pCommand->command );
             break;
         }
 
@@ -2410,8 +2398,8 @@
 
     if( !PMC_IS_READY(pMac) )
     {
-        smsLog(pMac, LOGE, FL("Requesting IMPS when PMC not ready\n"));
-        smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s\n"),
+        smsLog(pMac, LOGE, FL("Requesting IMPS when PMC not ready"));
+        smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s"),
             pMac->pmc.pmcReady, pmcGetPmcStateStr(pMac->pmc.pmcState));
         return eHAL_STATUS_FAILURE;
     }
@@ -2419,21 +2407,21 @@
     /* Check if IMPS is enabled. */
     if (!pMac->pmc.impsEnabled)
     {
-        smsLog(pMac, LOG2, FL("IMPS is disabled\n"));
+        smsLog(pMac, LOG2, FL("IMPS is disabled"));
         return eHAL_STATUS_PMC_DISABLED;
     }
 
     /* Check if IMPS enabled for current power source. */
     if ((pMac->pmc.powerSource == AC_POWER) && !pMac->pmc.impsConfig.enterOnAc)
     {
-        smsLog(pMac, LOG2, FL("IMPS is disabled when operating on AC power\n"));
+        smsLog(pMac, LOG2, FL("IMPS is disabled when operating on AC power"));
         return eHAL_STATUS_PMC_AC_POWER;
     }
 
     /* Check that entry into a power save mode is allowed at this time. */
     if (!pmcPowerSaveCheck(pMac))
     {
-        smsLog(pMac, LOG2, FL("IMPS cannot be entered now\n"));
+        smsLog(pMac, LOG2, FL("IMPS cannot be entered now"));
         return eHAL_STATUS_PMC_NOT_NOW;
     }
 
@@ -2441,7 +2429,7 @@
        running sessions agree. */
     if (!pmcAllowImps(pMac))
     {
-        smsLog(pMac, LOG2, FL("IMPS cannot be entered now\n"));
+        smsLog(pMac, LOG2, FL("IMPS cannot be entered now"));
         return eHAL_STATUS_PMC_NOT_NOW;
     }
 
@@ -2449,7 +2437,7 @@
     if ((pMac->pmc.pmcState == REQUEST_IMPS) || (pMac->pmc.pmcState == IMPS) ||
         (pMac->pmc.pmcState == REQUEST_FULL_POWER))
     {
-        smsLog(pMac, LOG2, FL("Already in IMPS\n"));
+        smsLog(pMac, LOG2, FL("Already in IMPS"));
         return eHAL_STATUS_PMC_ALREADY_IN_IMPS;
     }
 
@@ -2465,14 +2453,14 @@
    /* Check if BMPS is enabled. */
    if (!pMac->pmc.bmpsEnabled)
    {
-      smsLog(pMac, LOGE, "PMC: Cannot initiate BMPS. BMPS is disabled\n");
+      smsLog(pMac, LOGE, "PMC: Cannot initiate BMPS. BMPS is disabled");
       return eHAL_STATUS_PMC_DISABLED;
    }
 
    if( !PMC_IS_READY(pMac) )
    {
-       smsLog(pMac, LOGE, FL("Requesting BMPS when PMC not ready\n"));
-       smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s\n"),
+       smsLog(pMac, LOGE, FL("Requesting BMPS when PMC not ready"));
+       smsLog(pMac, LOGE, FL("pmcReady = %d pmcState = %s"),
            pMac->pmc.pmcReady, pmcGetPmcStateStr(pMac->pmc.pmcState));
        return eHAL_STATUS_FAILURE;
    }
@@ -2480,20 +2468,20 @@
    /* Check that we are associated with a single active session. */
    if (!pmcValidateConnectState( pMac ))
    {
-      smsLog(pMac, LOGE, "PMC: STA not associated with an AP with single active session. BMPS cannot be entered\n");
+      smsLog(pMac, LOGE, "PMC: STA not associated with an AP with single active session. BMPS cannot be entered");
       return eHAL_STATUS_FAILURE;
    }
 
    /* BMPS can only be requested when device is in Full Power */
    if (pMac->pmc.pmcState != FULL_POWER)
    {
-      smsLog(pMac, LOGE, "PMC: Device not in full power. Cannot request BMPS. pmcState %d\n", pMac->pmc.pmcState);
+      smsLog(pMac, LOGE, "PMC: Device not in full power. Cannot request BMPS. pmcState %d", pMac->pmc.pmcState);
       return eHAL_STATUS_FAILURE;
    }
    /* Check that entry into a power save mode is allowed at this time. */
    if (!pmcPowerSaveCheck(pMac))
    {
-      smsLog(pMac, LOGE, "PMC: Power save check failed. BMPS cannot be entered now\n");
+      smsLog(pMac, LOGE, "PMC: Power save check failed. BMPS cannot be entered now");
       return eHAL_STATUS_PMC_NOT_NOW;
    }
 
@@ -2501,13 +2489,13 @@
     //BMPS_WORKAROUND_NOT_NEEDED
     if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION))
     {
-        smsLog(pMac, LOG1, FL("doBMPSWorkaround %u\n"), pMac->roam.configParam.doBMPSWorkaround);
+        smsLog(pMac, LOG1, FL("doBMPSWorkaround %u"), pMac->roam.configParam.doBMPSWorkaround);
         if (pMac->roam.configParam.doBMPSWorkaround)
         {
             pMac->roam.configParam.doBMPSWorkaround = 0;
-            smsLog(pMac, LOG1, FL("reset doBMPSWorkaround to disabled %u\n"), pMac->roam.configParam.doBMPSWorkaround);
+            smsLog(pMac, LOG1, FL("reset doBMPSWorkaround to disabled %u"), pMac->roam.configParam.doBMPSWorkaround);
             csrDisconnectAllActiveSessions(pMac);
-            smsLog(pMac, LOGE, "PMC: doBMPSWorkaround was enabled. First Disconnect all sessions. pmcState %d\n", pMac->pmc.pmcState);
+            smsLog(pMac, LOGE, "PMC: doBMPSWorkaround was enabled. First Disconnect all sessions. pmcState %d", pMac->pmc.pmcState);
             return eHAL_STATUS_FAILURE;
         }
      }
@@ -2570,12 +2558,12 @@
 
     WLAN_VOS_DIAG_EVENT_REPORT(&psRequest, EVENT_WLAN_POWERSAVE_GENERIC);
 
-    smsLog(pMac, LOGW, FL("DIAG event timer expired\n"));
+    smsLog(pMac, LOGW, FL("DIAG event timer expired"));
 
     /* re-arm timer */
     if (pmcStartDiagEvtTimer(hHal) != eHAL_STATUS_SUCCESS)
     {
-        smsLog(pMac, LOGP, FL("Cannot re-arm DIAG evt timer\n"));
+        smsLog(pMac, LOGP, FL("Cannot re-arm DIAG evt timer"));
     }
 }
 
@@ -2583,12 +2571,12 @@
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 
-    smsLog(pMac, LOG2, FL("Entering pmcStartDiagEvtTimer\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcStartDiagEvtTimer"));
 
     if (palTimerStart(pMac->hHdd, pMac->pmc.hDiagEvtTimer, PMC_DIAG_EVT_TIMER_INTERVAL *
                           1000, TRUE) != eHAL_STATUS_SUCCESS)
     {
-       smsLog(pMac, LOGP, FL("Cannot start DIAG evt timer\n"));
+       smsLog(pMac, LOGP, FL("Cannot start DIAG evt timer"));
        return eHAL_STATUS_FAILURE;
     }
 
@@ -2598,7 +2586,7 @@
 void pmcStopDiagEvtTimer (tHalHandle hHal)
 {
     tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
-    smsLog(pMac, LOG2, FL("Entering pmcStopDiagEvtTimer\n"));
+    smsLog(pMac, LOG2, FL("Entering pmcStopDiagEvtTimer"));
     (void)palTimerStop(pMac->hHdd, pMac->pmc.hDiagEvtTimer);
 }
 #endif
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index dd31905..7dda7ec 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -7522,6 +7522,19 @@
 {
     return (BMPS == pmcGetPmcState(hHal));
 }
+/* ---------------------------------------------------------------------------
+    \fn sme_SetTdlsPowerSaveProhibited
+    \API to set/reset the isTdlsPowerSaveProhibited.
+
+    \- return void
+    -------------------------------------------------------------------------*/
+void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
+{
+    tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+
+    pMac->isTdlsPowerSaveProhibited = val;
+    return;
+}
 #endif
 #ifdef FEATURE_WLAN_TDLS_INTERNAL
 /*