wlan: LFR does not bgscan on channel list from cfg.ini

1. In the CSR roaming code, We roll back to cfg.ini channels only when
occupied
channels list is 0. but when we complete the first UI Scan and find a
matching AP,
this occupied channel list is non-zero. hence we won't take the cfg.ini
route.
Fix is to build occupied channels list only if channel list in cfg.ini
(gNeighborScanChannelList) is 0.

2. After the Cl 657615, simple_strtoul kernel API is replaced by
kstrtoul, but the earlier
API used to take care of string buffer with delimiter, but kstrtoul does
not take care
of this and we always see this function returns -ve number.
Fix is to use the other block of code in the same function to use
strpbrk.

Change-Id: I1a1c8ae35a68054948cfbd8ce83f53d439d5c5eb
CR-Fixed: 429923
diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c
index 17bf72f..15d03d4 100644
--- a/CORE/HDD/src/wlan_hdd_cfg.c
+++ b/CORE/HDD/src/wlan_hdd_cfg.c
@@ -2635,7 +2635,6 @@
    }
    *len = 0;
 
-#ifdef VERSION_USING_STRPBRK
    while ( (s != NULL) && (*len < intArrayMaxLen) )
    {
       int val;
@@ -2650,24 +2649,6 @@
       if( s )
          s++;
    }
-#else
-   while( (*s != '\0')  && (*len < intArrayMaxLen) )
-   {
-      unsigned long val;
-      int rv;
-
-      rv = kstrtoul( s, 10, &val );
-      if (rv < 0)
-          return VOS_STATUS_E_INVAL;
-      if( val )
-      {
-         intArray[*len] = (tANI_U8) val;
-         *len += 1;
-      }
-      if( *s )
-         s++;
-   }
-#endif
 
    return VOS_STATUS_SUCCESS;
    
diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c
index fddeb11..5646342 100644
--- a/CORE/SME/src/csr/csrApiScan.c
+++ b/CORE/SME/src/csr/csrApiScan.c
@@ -1857,11 +1857,20 @@
 //pIes can not be NULL
 static void csrScanAddResult(tpAniSirGlobal pMac, tCsrScanResult *pResult, tDot11fBeaconIEs *pIes)
 {
+#ifdef FEATURE_WLAN_LFR 
+    tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+#endif
+
     pResult->preferValue = csrGetBssPreferValue(pMac, (int)pResult->Result.BssDescriptor.rssi);
     pResult->capValue = csrGetBssCapValue(pMac, &pResult->Result.BssDescriptor, pIes);
     csrLLInsertTail( &pMac->scan.scanResultList, &pResult->Link, LL_ACCESS_LOCK );
 #ifdef FEATURE_WLAN_LFR
-    csrScanAddToOccupiedChannels(pMac, pResult, &pMac->scan.occupiedChannels, pIes);
+    if(0 == pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels)
+    {
+        /* Build the occupied channel list, only if "gNeighborScanChannelList" is 
+           NOT set in the cfg.ini file */
+        csrScanAddToOccupiedChannels(pMac, pResult, &pMac->scan.occupiedChannels, pIes);
+    }
 #endif
 }
 
@@ -6996,6 +7005,15 @@
   tListElem *pEntry = NULL;
   tCsrScanResult *pBssDesc = NULL;
   tDot11fBeaconIEs *pIes = NULL;
+  tpCsrNeighborRoamControlInfo    pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
+
+  if (0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels)
+  {
+       smsLog(pMac, LOG1, FL("%s: Ini file contains neighbor scan channel list,"
+             " hence NO need to build occupied channel list (numChannels = %d)\n"),
+              __func__, pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels);
+      return;
+  }
 
   if (!csrNeighborRoamIsNewConnectedProfile(pMac))
   {