prima: WLAN Driver Release 3.2.0.9
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 6088825..ef35511 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -410,6 +410,7 @@
  */
 int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand)
 {
+    ENTER();
     switch(eBand)
     {
         case eCSR_BAND_24:
@@ -438,6 +439,8 @@
                                hdd_config_t *pCfg
                                )
 {
+    ENTER();
+
     /* Now bind the underlying wlan device with wiphy */
     set_wiphy_dev(wiphy, dev);
 
@@ -448,7 +451,8 @@
                     | WIPHY_FLAG_CUSTOM_REGULATORY;
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
-    wiphy->flags |=   WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+    wiphy->flags |=   WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL 
+                    | WIPHY_FLAG_OFFCHAN_TX;
 #endif
 
     wiphy->max_scan_ssids = MAX_SCAN_SSID; 
@@ -536,6 +540,8 @@
     /* Register for all P2P action, public action etc frames */
     v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4);
 
+    ENTER();
+
    /* Right now we are registering these frame when driver is getting
       initialized. Once we will move to 2.6.37 kernel, in which we have
       frame register ops, we will move this code as a part of that */
@@ -574,6 +580,8 @@
     /* Register for all P2P action, public action etc frames */
     v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4);
 
+    ENTER();
+
    /* Right now we are registering these frame when driver is getting
       initialized. Once we will move to 2.6.37 kernel, in which we have
       frame register ops, we will move this code as a part of that */
@@ -676,6 +684,7 @@
     beacon_data_t *old = NULL;
     int head_len,tail_len;
 
+    ENTER();
     if (params->head && !params->head_len)
         return -EINVAL;
 
@@ -882,6 +891,7 @@
     v_U8_t *pIe = NULL;
     v_U8_t addIE[1] = {0};
     beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon;
+    int ret = 0;
 
     genie = vos_mem_malloc(MAX_GENIE_LEN);
 
@@ -903,7 +913,8 @@
         else 
         {
             hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too big***\n");
-            return -EINVAL;
+            ret = -EINVAL;
+            goto done;
         }
         total_ielen = ielen;
     }
@@ -919,7 +930,8 @@
         }
         else {
            hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie + P2p Ie + Wfd Ie Length is too big***\n");
-           return -EINVAL;
+           ret = -EINVAL;
+           goto done;
         }
         total_ielen += ielen; 
     }
@@ -939,7 +951,8 @@
         {
             hddLog( VOS_TRACE_LEVEL_ERROR, 
                     "**Wps Ie+ P2pIE Length is too big***\n");
-            return -EINVAL;
+            ret = -EINVAL;
+            goto done;
         }
         total_ielen += ielen;
     }
@@ -951,7 +964,8 @@
     {
         hddLog(LOGE,
                "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM");
-        return -EINVAL;
+        ret = -EINVAL;
+        goto done;
     }
 
     if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
@@ -962,7 +976,8 @@
     {
         hddLog(LOGE,
             "Could not pass on WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM");
-        return -EINVAL;
+        ret = -EINVAL;
+        goto done;
     }
 
     // Added for ProResp IE
@@ -1002,7 +1017,8 @@
             {
                  hddLog(LOGE,
                        "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM");
-                 return -EINVAL;
+                 ret = -EINVAL;
+                 goto done;
             }
             rem_probe_resp_ie_len += probe_rsp_ie_len[0];
         }
@@ -1017,7 +1033,8 @@
             {
                  hddLog(LOGE,
                        "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM");
-                 return -EINVAL;
+                 ret = -EINVAL;
+                 goto done;
             }
             rem_probe_resp_ie_len += probe_rsp_ie_len[1];
         }
@@ -1032,7 +1049,8 @@
             {
                  hddLog(LOGE,
                        "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM");
-                 return -EINVAL;
+                 ret = -EINVAL;
+                 goto done;
             }
             rem_probe_resp_ie_len += probe_rsp_ie_len[2];
         }
@@ -1067,7 +1085,8 @@
         {
            hddLog(LOGE,
              "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM");
-           return -EINVAL;
+           ret = -EINVAL;
+           goto done;
         }
     }
     else
@@ -1090,7 +1109,8 @@
        {
             hddLog(LOGE,
                   "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM");
-            return -EINVAL;
+            ret = -EINVAL;
+            goto done;
        }
 
        if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal,
@@ -1101,7 +1121,8 @@
        {
           hddLog(LOGE,
             "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM");
-          return -EINVAL;
+          ret = -EINVAL;
+          goto done;
        }
     }
     else
@@ -1119,6 +1140,7 @@
         }
     }
 
+done:
     vos_mem_free(genie);
     return 0;
 }
@@ -1445,6 +1467,15 @@
     }
     wlan_hdd_set_sapHwmode(pHostapdAdapter);
 
+#ifdef WLAN_FEATURE_11AC
+    if(((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_AUTO) || 
+       ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac) ||
+       ((WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY) )
+    {
+        pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac;
+    }
+#endif
+
     // ht_capab is not what the name conveys,this is used for protection bitmap
     pConfig->ht_capab =
                  (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection;
@@ -1625,9 +1656,23 @@
 #endif
 {
     hdd_adapter_t *pAdapter =  WLAN_HDD_GET_PRIV_PTR(dev);
-    hdd_context_t *pHddCtx;
+    hdd_context_t  *pHddCtx    = NULL;
+    hdd_scaninfo_t *pScanInfo  = NULL;
+    hdd_adapter_t  *staAdapter = NULL;
     VOS_STATUS status = 0;
 
+    staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION);
+
+    if (!staAdapter)
+    {
+        staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT);
+    }
+
+    if (staAdapter != NULL)
+    {
+        pScanInfo =  &staAdapter->scan_info;
+    }
+
     ENTER();
 
     if (NULL == pAdapter)
@@ -1647,6 +1692,23 @@
     hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
                               __func__,pAdapter->device_mode);
 
+    if ((pScanInfo != NULL) && pScanInfo->mScanPending)
+    {
+        INIT_COMPLETION(staAdapter->abortscan_event_var);
+        hdd_abort_mac_scan(staAdapter->pHddCtx);
+        status = wait_for_completion_interruptible_timeout(
+                           &staAdapter->abortscan_event_var,
+                           msecs_to_jiffies(WLAN_WAIT_TIME_ABORTSCAN));
+        if (!status)
+        {
+            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+                         "%s: Timeout occured while waiting for abortscan" ,
+                         __FUNCTION__);
+            VOS_ASSERT(pScanInfo->mScanPending);
+            return 0;
+        }
+    }
+
     if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
 #ifdef WLAN_FEATURE_P2P
      || (pAdapter->device_mode == WLAN_HDD_P2P_GO)
@@ -1892,6 +1954,7 @@
     if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION)
 #ifdef WLAN_FEATURE_P2P
       || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)
+      || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE)
 #endif
       )
     {
@@ -1908,8 +1971,14 @@
                 hddLog(VOS_TRACE_LEVEL_INFO,
                    "%s: setting interface Type to INFRASTRUCTURE", __func__);
                 pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
-                pRoamProfile->phyMode =
-                   hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
+#ifdef WLAN_FEATURE_11AC
+                if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO)
+                {
+                    pConfig->dot11Mode = eHDD_DOT11_MODE_11ac;
+                }
+#endif
+                pRoamProfile->phyMode = 
+                hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
                 wdev->iftype = type;
 #ifdef WLAN_FEATURE_P2P
                 pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ?
@@ -2005,6 +2074,10 @@
                 status = hdd_init_station_mode( pAdapter );
                 if( VOS_STATUS_SUCCESS != status )
                     return -EOPNOTSUPP;
+                /* In case of JB, for P2P-GO, only change interface will be called,
+                 * This is the right place to enable back bmps_imps()
+                 */
+                hdd_enable_bmps_imps(pHddCtx);
                 goto done;
             case NL80211_IFTYPE_AP:
 #ifdef WLAN_FEATURE_P2P
@@ -2082,6 +2155,8 @@
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     v_MACADDR_t STAMacAddress;
 
+    ENTER();
+
     if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
     {
         VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
@@ -2108,6 +2183,7 @@
         }
     }
     
+    EXIT();
     return status;
 }
 
@@ -2711,6 +2787,7 @@
         }
     }
 #endif
+    EXIT();
     return status;
 }
 
@@ -3048,12 +3125,27 @@
     struct cfg80211_bss *bss_status = NULL;
     size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length;
     int rssi = 0;
+#ifdef WLAN_OPEN_SOURCE
+    struct timespec ts;
+#endif
 
     ENTER();
 
     memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN);
+
+#ifdef WLAN_OPEN_SOURCE
+    /* Android does not want the timestamp from the frame.
+       Instead it wants a monotonic increasing value */
+    get_monotonic_boottime(&ts);
+    mgmt->u.probe_resp.timestamp =
+         ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000);
+#else
+    /* keep old behavior for non-open source (for now) */
     memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp,
             sizeof (bss_desc->timeStamp));
+
+#endif
+
     mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval;
     mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo;
     memcpy(mgmt->u.probe_resp.variable, ie, ie_length);
@@ -3242,16 +3334,16 @@
 
 #define dump_bssid(bssid) \
     { \
-        hddLog(VOS_TRACE_LEVEL_FATAL, "BSSID (MAC) address:\t"); \
-        hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_FATAL);\
-        hddLog(VOS_TRACE_LEVEL_FATAL, "\n"); \
+        hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \
+        hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\
+        hddLog(VOS_TRACE_LEVEL_INFO, "\n"); \
     }
 
 #define dump_pmkid(pMac, pmkid) \
     { \
-        hddLog(VOS_TRACE_LEVEL_FATAL, "PMKSA-ID:\t"); \
-        hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_FATAL);\
-        hddLog(VOS_TRACE_LEVEL_FATAL, "\n"); \
+        hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \
+        hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\
+        hddLog(VOS_TRACE_LEVEL_INFO, "\n"); \
     }
 
 #ifdef FEATURE_WLAN_LFR
@@ -3263,10 +3355,11 @@
                     hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, 
                     int index, bool preauth )
 {
+#ifdef FEATURE_WLAN_OKC
     struct net_device *dev = pAdapter->dev;
 
     ENTER();
-    printk("%s is going to notify supplicant of:", __func__);
+    hddLog(VOS_TRACE_LEVEL_INFO, "%s is going to notify supplicant of:", __func__);
 
     if( NULL == pRoamInfo )
     {
@@ -3277,7 +3370,7 @@
     dump_bssid(pRoamInfo->bssid);
     cfg80211_pmksa_candidate_notify(dev, index,
                                     pRoamInfo->bssid, preauth, GFP_KERNEL);
-
+#endif  /* FEATURE_WLAN_OKC */
     return 0; 
 }
 #endif //FEATURE_WLAN_LFR
@@ -3294,7 +3387,6 @@
     //struct wireless_dev *wdev = dev->ieee80211_ptr;    
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
     hdd_scaninfo_t *pScanInfo = &pAdapter->scan_info;
-    hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
     struct cfg80211_scan_request *req = NULL;
     int ret = 0;
 
@@ -3312,13 +3404,13 @@
     if (!ret)
     {
        VOS_ASSERT(pScanInfo->mScanPending);
-       return 0;
+       goto allow_suspend;
     }
 
     if(pScanInfo->mScanPending != VOS_TRUE)
     {
         VOS_ASSERT(pScanInfo->mScanPending);
-        return 0;
+        goto allow_suspend;
     }
 
     /* Check the scanId */
@@ -3330,9 +3422,6 @@
                 (int) scanId);
     }
 
-    /* Scan is no longer pending */
-    pScanInfo->mScanPending = VOS_FALSE;
-
     ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, 
                                         pAdapter);
 
@@ -3372,7 +3461,7 @@
     if (!req)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL\n");
-        return 0;
+        goto allow_suspend;
     }
 
     /*
@@ -3389,21 +3478,27 @@
     cfg80211_scan_done(req, false);
     complete(&pAdapter->abortscan_event_var);
     pAdapter->request = NULL;
+    /* Scan is no longer pending */
+    pScanInfo->mScanPending = VOS_FALSE;
 
 #ifdef WLAN_FEATURE_P2P
     /* Flush out scan result after p2p_serach is done */
-    if(pScanInfo->p2pSearch )
+    if(pScanInfo->flushP2pScanResults)
     {
         tANI_U8 sessionId = pAdapter->sessionId;
-        if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-        { 
-            sessionId = pAdapter->p2pSessionId;
-        } 
         sme_ScanFlushResult(WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId);
-        pScanInfo->p2pSearch = 0;
+        pScanInfo->flushP2pScanResults = 0;
     }
 #endif
 
+allow_suspend:
+    /* release the wake lock */
+    if((eConnectionState_NotConnected == 
+         (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
+    {
+        hdd_allow_suspend();
+    }
+
     EXIT();
     return 0;
 }
@@ -3425,6 +3520,7 @@
     v_U32_t scanId = 0;
     int status = 0;
     hdd_scaninfo_t *pScanInfo = &pAdapter->scan_info;
+    v_U8_t preventSuspend = 0;
 #ifdef WLAN_FEATURE_P2P
     v_U8_t* pP2pIe = NULL;
 #endif
@@ -3585,7 +3681,8 @@
             pScanInfo->scanAddIE.length = request->ie_len;
 
             if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
-                (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)
+                (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ||
+                (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)
               )
             {
                pwextBuf->roamProfile.pAddIEScan = pScanInfo->scanAddIE.addIEdata;
@@ -3600,25 +3697,38 @@
                                                        request->ie_len);
             if (pP2pIe != NULL)
             {
-                if ( (request->n_ssids == 1) && 
-                     (request->ssids[0].ssid_len == P2P_WILDCARD_SSID_LEN) &&
-                     !memcmp(request->ssids[0].ssid, P2P_WILDCARD_SSID,
-                             P2P_WILDCARD_SSID_LEN ))
+                /* no_cck will be set during p2p find to disable 11b rates */
+                if(TRUE == request->no_cck)
                 {
                     tANI_U8 sessionId = pAdapter->sessionId;
                     hddLog(VOS_TRACE_LEVEL_INFO,
                            "%s: This is a P2P Search", __func__);
                     scanRequest.p2pSearch = 1;
-                    pScanInfo->p2pSearch = 1;
+
+                    /* Flush the scan results only for P2P search.
+                       P2P search happens on 3 social channels (1, 6, 11) */
+                    if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS )
+                    {
+                         pScanInfo->flushP2pScanResults = 1;
+                         sme_ScanFlushResult( WLAN_HDD_GET_HAL_CTX(pAdapter),
+                                          sessionId );
+                    }
+
+                    /*
+                       Skip Dfs Channel in case of P2P Search
+                       if it is set in ini file
+                    */
+                    if(cfg_param->skipDfsChnlInP2pSearch)
+                    {
+                       scanRequest.skipDfsChnlInP2pSearch = 1;
+                    }
+                    else
+                    {
+                       scanRequest.skipDfsChnlInP2pSearch = 0;
+                    }
 
                     /* set requestType to P2P Discovery */
                     scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY;
-                    if (pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated)
-                    {
-                        sessionId = pAdapter->p2pSessionId;
-                    }
-                    sme_ScanFlushResult( WLAN_HDD_GET_HAL_CTX(pAdapter),
-                                          sessionId );
                 }
             }
 #endif
@@ -3627,26 +3737,29 @@
 
     INIT_COMPLETION(pScanInfo->scan_req_completion_event);
 
-    if ((pHddCtx->cfg_ini->isP2pDeviceAddrAdministrated) &&
-        (scanRequest.p2pSearch))
+    /*If the station is not connected and recieved a scan request, acquire the 
+     * wake lock to not request the suspend from Android*/
+    if((eConnectionState_NotConnected == 
+         (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
     {
-        status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
-                              pAdapter->p2pSessionId, &scanRequest, &scanId,
-                              &hdd_cfg80211_scan_done_callback, dev );
+        preventSuspend = 1;
+        hdd_prevent_suspend();
     }
-    else
-    {
-        status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
+
+    status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
                               pAdapter->sessionId, &scanRequest, &scanId,
                               &hdd_cfg80211_scan_done_callback, dev );
-    }
-    
+
     if (eHAL_STATUS_SUCCESS != status)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR,
                 "%s: sme_ScanRequest returned error %d", __func__, status);
         complete(&pScanInfo->scan_req_completion_event);
         status = -EIO;
+        if(preventSuspend)
+        {
+            hdd_allow_suspend();
+        }
         goto free_mem;
     }
 
@@ -3698,9 +3811,14 @@
 
     if (pRoamProfile) 
     {
-        if (hdd_connGetConnectedBssType(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
-            &connectedBssType ) || ( eMib_dot11DesiredBssType_independent == 
-              connectedBssType))
+        int ret = 0;
+        hdd_station_ctx_t *pHddStaCtx;
+        pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+        hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType );
+
+        if((eMib_dot11DesiredBssType_independent == connectedBssType) ||
+           (eConnectionState_Associated == pHddStaCtx->conn_info.connState) ||
+           (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState))
         {
             /* Issue disconnect to CSR */
             INIT_COMPLETION(pAdapter->disconnect_comp_var);
@@ -3709,9 +3827,23 @@
                             pAdapter->sessionId,
                             eCSR_DISCONNECT_REASON_UNSPECIFIED ) )
             {
-                wait_for_completion_interruptible_timeout(
-                        &pAdapter->disconnect_comp_var,
-                        msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+                ret = wait_for_completion_interruptible_timeout(
+                             &pAdapter->disconnect_comp_var,
+                             msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+                if (0 == ret)
+                {
+                    VOS_ASSERT(0);
+                }
+            }
+        }
+        else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState)
+        {
+            ret = wait_for_completion_interruptible_timeout(
+                         &pAdapter->disconnect_comp_var,
+                         msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+            if (0 == ret)
+            {
+                VOS_ASSERT(0);
             }
         }
 
@@ -4952,6 +5084,8 @@
     hdd_adapter_t *pAdapter;
     hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
 
+    ENTER();
+
     if (NULL == pHddCtx)
     {
         hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
@@ -4976,6 +5110,7 @@
     wlan_hdd_get_classAstats(pAdapter);
     *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr;
 
+    EXIT();
     return 0;
 }
 
@@ -5005,6 +5140,8 @@
     tANI_U8  rateFlag = 1;
     tANI_U8  i, j, rssidx;
 
+    ENTER();
+
     if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) ||
             (0 == ssidlen))
     {
@@ -5081,7 +5218,7 @@
         ccmCfgGetStr(hHal, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, &ORLeng);
         for (i = 0; i < ORLeng; i++)
         {
-            for (j = 0; j < sizeof(supported_data_rate); j ++)
+            for (j = 0; j < (sizeof(supported_data_rate) / sizeof(supported_data_rate[0])); j ++)
             {
                 /* Validate Rate Set */
                 if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F))
@@ -5098,7 +5235,7 @@
         ccmCfgGetStr(hHal, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedRates, &ERLeng);
         for (i = 0; i < ERLeng; i++)
         {
-            for (j = 0; j < sizeof(supported_data_rate); j ++)
+            for (j = 0; j < (sizeof(supported_data_rate) / sizeof(supported_data_rate[0])); j ++)
             {
                 if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F))
                 {
@@ -5128,7 +5265,7 @@
 
             for (i = 0; i < MCSLeng; i++)
             {
-                for (j = 0; j < sizeof(supported_mcs_rate); j++)
+                for (j = 0; j < (sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0])); j++)
                 {
                     if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i])
                     {
@@ -5220,6 +5357,7 @@
     }
     sinfo->filled |= STATION_INFO_TX_BITRATE;
 
+    EXIT();
     return 0;
 }
 
@@ -5229,6 +5367,8 @@
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
     VOS_STATUS vos_status;
 
+    ENTER();
+
     if (NULL == pAdapter)
     {
         hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL\n", __func__);
@@ -5247,6 +5387,7 @@
      **/
     vos_status =  wlan_hdd_enter_bmps(pAdapter, !mode);
 
+    EXIT();
     if (VOS_STATUS_E_FAILURE == vos_status)
     {
         return -EINVAL;
@@ -5260,6 +5401,7 @@
                          struct net_device *netdev,
                          u8 key_index)
 {
+    ENTER();
     return 0;
 }
 #endif //LINUX_VERSION_CODE 
@@ -5269,12 +5411,14 @@
                    struct net_device *dev,
                    struct ieee80211_txq_params *params)
 {
+    ENTER();
     return 0;
 }
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
 static int wlan_hdd_set_txq_params(struct wiphy *wiphy,
                    struct ieee80211_txq_params *params)
 {
+    ENTER();
     return 0;
 }
 #endif //LINUX_VERSION_CODE
@@ -5284,6 +5428,7 @@
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
 
+    ENTER();
     if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
     {
         hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Invalid Adapter or HDD Context " ,__func__);
@@ -5349,6 +5494,7 @@
           struct net_device *dev, u8 *mac, struct station_parameters *params)
 {
     // TODO: Implement this later.
+    ENTER();
     return 0;
 }
 
@@ -5366,6 +5512,8 @@
     eHalStatus result; 
     tANI_U8  BSSIDMatched = 0;
    
+    ENTER();
+
     // Validate pAdapter  
     if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
     {
@@ -5444,12 +5592,14 @@
 static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev,
             struct cfg80211_pmksa *pmksa)
 {
+    ENTER();
     // TODO: Implement this later.
     return 0;
 }
 
 static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev)
 {
+    ENTER();
     // TODO: Implement this later.
     return 0;
 }