wlan: Replace init work related functions with wrapper APIs.

Proprietary driver can not access INIT_WORK and
INIT_DELAYED_WORK kernel APIs.
To mitigate issue replace above init work related functions
with vos wrapper APIs.

CRs-Fixed: 847627
Change-Id: Ic3b9a0e3d2057b0e1e8e9b4d0fba2f3cdb1fef9a
diff --git a/CORE/HDD/src/bap_hdd_main.c b/CORE/HDD/src/bap_hdd_main.c
index 79bca9e..af48dab 100644
--- a/CORE/HDD/src/bap_hdd_main.c
+++ b/CORE/HDD/src/bap_hdd_main.c
@@ -4164,7 +4164,7 @@
         // save away the pctx context...so it can be retrieved by the work procedure.
         pHciContext->pctx = pctx;
         pHciContext->magic = BT_AMP_HCI_CTX_MAGIC;
-        INIT_WORK(&pHciContext->hciInterfaceProcessing,
+        vos_init_work(&pHciContext->hciInterfaceProcessing,
                   bslWriteFinish);
 
         VOS_TRACE(VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 0cb4e33..50ebcb0 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -6844,11 +6844,11 @@
          }
 
          // Workqueue which gets scheduled in IPv4 notification callback.
-         INIT_WORK(&pAdapter->ipv4NotifierWorkQueue, hdd_ipv4_notifier_work_queue);
+         vos_init_work(&pAdapter->ipv4NotifierWorkQueue, hdd_ipv4_notifier_work_queue);
 
 #ifdef WLAN_NS_OFFLOAD
          // Workqueue which gets scheduled in IPv6 notification callback.
-         INIT_WORK(&pAdapter->ipv6NotifierWorkQueue, hdd_ipv6_notifier_work_queue);
+         vos_init_work(&pAdapter->ipv6NotifierWorkQueue, hdd_ipv6_notifier_work_queue);
 #endif
          //Stop the Interface TX queue.
          hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues"));
@@ -6861,7 +6861,7 @@
          {
              /* Initialize the work queue to defer the
               * back to back RoC request */
-             INIT_DELAYED_WORK(&pAdapter->roc_work,
+             vos_init_delayed_work(&pAdapter->roc_work,
                      hdd_p2p_roc_work_queue);
          }
 
@@ -7267,19 +7267,13 @@
                   break;
                }
             }
-#ifdef WLAN_OPEN_SOURCE
-          cancel_delayed_work_sync(&pAdapter->roc_work);
-#endif
+          vos_flush_delayed_work(&pAdapter->roc_work);
        }
 #ifdef WLAN_NS_OFFLOAD
-#ifdef WLAN_OPEN_SOURCE
-         cancel_work_sync(&pAdapter->ipv6NotifierWorkQueue);
-#endif
+         vos_flush_work(&pAdapter->ipv6NotifierWorkQueue);
 #endif
 
-#ifdef WLAN_OPEN_SOURCE
-         cancel_work_sync(&pAdapter->ipv4NotifierWorkQueue);
-#endif
+         vos_flush_work(&pAdapter->ipv4NotifierWorkQueue);
 
          /* It is possible that the caller of this function does not
           * wish to close the session
@@ -7329,9 +7323,7 @@
                }
             }
 
-#ifdef WLAN_OPEN_SOURCE
-            cancel_delayed_work_sync(&pAdapter->roc_work);
-#endif
+            vos_flush_delayed_work(&pAdapter->roc_work);
          }
          mutex_lock(&pHddCtx->sap_lock);
          if (test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) 
diff --git a/CORE/HDD/src/wlan_hdd_tdls.c b/CORE/HDD/src/wlan_hdd_tdls.c
index 6fca206..9100053 100644
--- a/CORE/HDD/src/wlan_hdd_tdls.c
+++ b/CORE/HDD/src/wlan_hdd_tdls.c
@@ -999,8 +999,9 @@
     pHddTdlsCtx->threshold_config.rssi_trigger_threshold = pHddCtx->cfg_ini->fTDLSRSSITriggerThreshold;
     pHddTdlsCtx->threshold_config.rssi_teardown_threshold = pHddCtx->cfg_ini->fTDLSRSSITeardownThreshold;
 
-    INIT_DELAYED_WORK(&pHddCtx->tdls_scan_ctxt.tdls_scan_work, wlan_hdd_tdls_schedule_scan);
-    set_bit(TDLS_INIT_DONE, &pAdapter->event_flags);
+    vos_init_delayed_work(&pHddCtx->tdls_scan_ctxt.tdls_scan_work,
+                          wlan_hdd_tdls_schedule_scan);
+     set_bit(TDLS_INIT_DONE, &pAdapter->event_flags);
 
     return 0;
 }
diff --git a/CORE/HDD/src/wlan_hdd_wmm.c b/CORE/HDD/src/wlan_hdd_wmm.c
index 395ff72..ae09c42 100644
--- a/CORE/HDD/src/wlan_hdd_wmm.c
+++ b/CORE/HDD/src/wlan_hdd_wmm.c
@@ -2366,7 +2366,7 @@
    pQosContext->qosFlowId = 0;
    pQosContext->handle = HDD_WMM_HANDLE_IMPLICIT;
    pQosContext->magic = HDD_WMM_CTX_MAGIC;
-   INIT_WORK(&pQosContext->wmmAcSetupImplicitQos,
+   vos_init_work(&pQosContext->wmmAcSetupImplicitQos,
              hdd_wmm_do_implicit_qos);
 
    VOS_TRACE(VOS_MODULE_ID_HDD, WMM_TRACE_LEVEL_INFO,
diff --git a/CORE/VOSS/inc/vos_api.h b/CORE/VOSS/inc/vos_api.h
index f0bf3d5..6d10490 100644
--- a/CORE/VOSS/inc/vos_api.h
+++ b/CORE/VOSS/inc/vos_api.h
@@ -329,6 +329,9 @@
 v_VOID_t vos_flush_work(struct work_struct *work);
 v_VOID_t vos_flush_delayed_work(struct delayed_work *dwork);
 
+v_VOID_t vos_init_work(struct work_struct *work , void *callbackptr);
+v_VOID_t vos_init_delayed_work(struct delayed_work *dwork , void *callbackptr);
+
 v_U64_t vos_get_monotonic_boottime(void);
 
 VOS_STATUS vos_randomize_n_bytes(void *mac_addr, tANI_U32 n);
diff --git a/CORE/VOSS/src/vos_api.c b/CORE/VOSS/src/vos_api.c
index c6f616d..e23dd61 100644
--- a/CORE/VOSS/src/vos_api.c
+++ b/CORE/VOSS/src/vos_api.c
@@ -2604,6 +2604,24 @@
 #endif
 }
 
+v_VOID_t vos_init_work(struct work_struct *work , void *callbackptr)
+{
+#if defined (WLAN_OPEN_SOURCE)
+   INIT_WORK(work,callbackptr);
+#else
+   wcnss_init_work(work, callbackptr);
+#endif
+}
+
+v_VOID_t vos_init_delayed_work(struct delayed_work *dwork , void *callbackptr)
+{
+#if defined (WLAN_OPEN_SOURCE)
+   INIT_DELAYED_WORK(dwork,callbackptr);
+#else
+   wcnss_init_delayed_work(dwork, callbackptr);
+#endif
+}
+
 /**
  * vos_set_multicast_logging() - Set mutlicast logging value
  * @value: Value of multicast logging