qcacmn: Replace void * tgt_if_handle with abstract type

Replace void * tgt_if_handle of objmgr psoc/pdev with
abstract type handles provided by target interface

Change-Id: I9e0ae991776daa0c25c4ad7b4e4dc022441318a3
CRs-Fixed: 2482708
diff --git a/target_if/core/inc/target_if.h b/target_if/core/inc/target_if.h
index 2780077..89830ec 100644
--- a/target_if/core/inc/target_if.h
+++ b/target_if/core/inc/target_if.h
@@ -1528,14 +1528,13 @@
 static inline struct wmi_unified *GET_WMI_HDL_FROM_PSOC(
 		struct wlan_objmgr_psoc *psoc)
 {
-	void *tgt_if_handle;
+	struct target_psoc_info *tgt_if_handle;
 
 	if (psoc) {
 		tgt_if_handle = psoc->tgt_if_handle;
 
 		if (tgt_if_handle)
-			return (target_psoc_get_wmi_hdl(
-				(struct target_psoc_info *)tgt_if_handle));
+			return target_psoc_get_wmi_hdl(tgt_if_handle);
 		else
 			return NULL;
 	}
@@ -1555,7 +1554,7 @@
 static inline struct wmi_unified *GET_WMI_HDL_FROM_PDEV(
 		struct wlan_objmgr_pdev *pdev)
 {
-	void *tgt_if_handle;
+	struct target_pdev_info *tgt_if_handle;
 
 	if (pdev) {
 		tgt_if_handle =  pdev->tgt_if_handle;
diff --git a/target_if/dispatcher/inc/target_if_pub.h b/target_if/dispatcher/inc/target_if_pub.h
new file mode 100644
index 0000000..84a24b7
--- /dev/null
+++ b/target_if/dispatcher/inc/target_if_pub.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * This file contains the structure definitions of target interface
+ * used for the abstraction across various layers.
+ */
+
+#ifndef _TARGET_IF_PUB_H_
+#define _TARGET_IF_PUB_H_
+
+/**
+ * typedef target_pdev_info_t - Opaque definition of target pdev
+ *				information structure
+ */
+struct target_pdev_info;
+typedef struct target_pdev_info target_pdev_info_t;
+
+/**
+ * typedef target_psoc_info_t - Opaque definition of target psoc
+ *				information structure
+ */
+struct target_psoc_info;
+typedef struct target_psoc_info target_psoc_info_t;
+#endif /* _TARGET_IF_PUB_H_ */
diff --git a/target_if/init_deinit/src/init_deinit_lmac.c b/target_if/init_deinit/src/init_deinit_lmac.c
index 2249cd5..e2f8fc4 100644
--- a/target_if/init_deinit/src/init_deinit_lmac.c
+++ b/target_if/init_deinit/src/init_deinit_lmac.c
@@ -240,7 +240,7 @@
 		target_if_err("psoc is null");
 		return;
 	}
-	tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle(psoc);
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
 	if (!tgt_hdl) {
 		target_if_err("target_psoc_info is null");
 		return;
diff --git a/target_if/init_deinit/src/init_event_handler.c b/target_if/init_deinit/src/init_event_handler.c
index 2e680b6..f769386 100644
--- a/target_if/init_deinit/src/init_event_handler.c
+++ b/target_if/init_deinit/src/init_event_handler.c
@@ -55,8 +55,7 @@
 		return -EINVAL;
 	}
 
-	tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle(
-						psoc);
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
 	if (!tgt_hdl) {
 		target_if_err("target_psoc_info is null in service ready ev");
 		return -EINVAL;
@@ -208,8 +207,7 @@
 		return -EINVAL;
 	}
 
-	tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle(
-						psoc);
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
 	if (!tgt_hdl) {
 		target_if_err("target_psoc_info is null in service ready ev");
 		return -EINVAL;
@@ -332,8 +330,7 @@
 		return -EINVAL;
 	}
 
-	tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle(
-						psoc);
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
 	if (!tgt_hdl) {
 		target_if_err("target_psoc_info is null");
 		return -EINVAL;
@@ -382,8 +379,7 @@
 		return -EINVAL;
 	}
 
-	tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle(
-						psoc);
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
 	if (!tgt_hdl) {
 		target_if_err("target_psoc_info is null");
 		return -EINVAL;
@@ -534,8 +530,7 @@
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle(
-						psoc);
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
 	if (!tgt_hdl) {
 		target_if_err("target_psoc_info null in register wmi hadler");
 		return QDF_STATUS_E_FAILURE;
diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h
index af52c1a..0067752 100644
--- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h
+++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h
@@ -24,6 +24,7 @@
 
 #include <wlan_objmgr_cmn.h>
 #include "wlan_objmgr_psoc_obj.h"
+#include <target_if_pub.h>
 
 /* STATUS: scanning */
 #define WLAN_PDEV_F_SCAN                    0x00000001
@@ -203,7 +204,7 @@
 	void *pdev_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS];
 	QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS];
 	WLAN_OBJ_STATE obj_state;
-	void *tgt_if_handle;
+	target_pdev_info_t *tgt_if_handle;
 	void *dp_handle;
 	qdf_spinlock_t pdev_lock;
 };
@@ -832,8 +833,9 @@
  *
  * Return: None
  */
-static inline void wlan_pdev_set_tgt_if_handle(struct wlan_objmgr_pdev *pdev,
-			void *tgt_if_handle)
+static inline
+void wlan_pdev_set_tgt_if_handle(struct wlan_objmgr_pdev *pdev,
+				 target_pdev_info_t *tgt_if_handle)
 {
 	/* This API is invoked with lock acquired, do not add log prints */
 	if (!pdev)
@@ -850,7 +852,8 @@
  *
  * Return: target interface handle
  */
-static inline void *wlan_pdev_get_tgt_if_handle(struct wlan_objmgr_pdev *pdev)
+static inline
+target_pdev_info_t *wlan_pdev_get_tgt_if_handle(struct wlan_objmgr_pdev *pdev)
 {
 	if (!pdev)
 		return NULL;
diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h
index f7eea2d..f44eb76 100644
--- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h
+++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h
@@ -25,6 +25,7 @@
 #include "wlan_objmgr_cmn.h"
 #include "wlan_objmgr_debug.h"
 #include "wlan_lmac_if_def.h"
+#include <target_if_pub.h>
 
 #define REG_DMN_CH144        0x0001
 #define REG_DMN_ENTREPRISE   0x0002
@@ -332,7 +333,7 @@
 	void *soc_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS];
 	QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS];
 	WLAN_OBJ_STATE obj_state;
-	void *tgt_if_handle;
+	target_psoc_info_t *tgt_if_handle;
 	void *dp_handle;
 	qdf_spinlock_t psoc_lock;
 };
@@ -1224,8 +1225,9 @@
  *
  * Return: None
  */
-static inline void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc,
-			void *tgt_if_handle)
+static inline
+void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc,
+				 target_psoc_info_t *tgt_if_handle)
 {
 	if (!psoc)
 		return;
@@ -1241,7 +1243,8 @@
  *
  * Return: target interface handle
  */
-static inline void *wlan_psoc_get_tgt_if_handle(struct wlan_objmgr_psoc *psoc)
+static inline
+target_psoc_info_t *wlan_psoc_get_tgt_if_handle(struct wlan_objmgr_psoc *psoc)
 {
 	if (!psoc)
 		return NULL;