wlan: Truncating batch scan response properly

HDD need to return only truncated batch scan response in next
subsequent GET commnd if previous scan response was truncated

Change-Id: I795f5e15e5615faec8de3f5525c50c2f8a430da0
CRs-Fixed: 572639
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 21b240f..aa51cce 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -1410,7 +1410,7 @@
 
     /*enough scan result available in cache to return to user space or
       scan result needs to be fetched 1st from fw and then return*/
-    if (len < rem_len)
+    if (len == cur_len)
     {
         pAdapter->hdd_wait_for_get_batch_scan_rsp = TRUE;
         halStatus = sme_TriggerBatchScanResultInd(
@@ -1448,7 +1448,7 @@
             len = (len - pPrivData->used_len);
             pDest = (command + pPrivData->used_len);
             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-               "BATCH SCAN RESULT:");
+               "NEW BATCH SCAN RESULT:");
             while(count < len)
             {
                 printk("%c", *(pDest + count));
@@ -1473,35 +1473,24 @@
     }
     else
     {
-        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-           "%s: copy %d data to user buffer", __func__, len);
         count = 0;
         len = (len - pPrivData->used_len);
         pDest = (command + pPrivData->used_len);
         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-            "BATCH SCAN RESULT:");
+            "REMAINING TRUNCATED BATCH SCAN RESULT:");
         while(count < len)
         {
             printk("%c", *(pDest + count));
             count++;
         }
+        VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+           "%s: copy %d data to user buffer", __func__, len);
         if (copy_to_user(pPrivData->buf, pDest, len))
         {
             VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
                "%s: failed to copy data to user buffer", __func__);
             return -EFAULT;
         }
-        pAdapter->hdd_wait_for_get_batch_scan_rsp = FALSE;
-        halStatus = sme_TriggerBatchScanResultInd(
-                        WLAN_HDD_GET_HAL_CTX(pAdapter), pReq,
-                        pAdapter->sessionId, hdd_batch_scan_result_ind_callback,
-                        pAdapter);
-        if ( eHAL_STATUS_SUCCESS != halStatus )
-        {
-            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
-                "sme_GetBatchScanScan  returned failure halStatus %d",
-                halStatus);
-        }
     }
 
    return 0;