From 0b9d3b241a35cedd62c967e53cd8c5dab35490e7 Mon Sep 17 00:00:00 2001 From: Srinivas Pitla Date: Mon, 22 Jan 2018 16:10:33 +0530 Subject: [PATCH] qcacmn: Define API to get component handles Introduce APIs set and get component handles Change-Id: I8bfcd802f10b8ecf9908a02d492f1ad757d8f7ec CRs-Fixed: 2177109 --- target_if/core/inc/target_if.h | 12 +--- target_if/core/src/target_if_main.c | 20 ------ target_if/init_deinit/inc/init_deinit_ucfg.h | 30 ++++++++ target_if/init_deinit/src/init_deinit_ucfg.c | 75 +++++++++++++++----- target_if/p2p/src/target_if_p2p.c | 17 ++--- 5 files changed, 99 insertions(+), 55 deletions(-) diff --git a/target_if/core/inc/target_if.h b/target_if/core/inc/target_if.h index 2dbcb6297ca5..eeeb41bb31c1 100644 --- a/target_if/core/inc/target_if.h +++ b/target_if/core/inc/target_if.h @@ -386,16 +386,6 @@ QDF_STATUS target_if_alloc_psoc_tgt_info(struct wlan_objmgr_psoc *psoc); */ QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc); -/** - * target_if_get_wmi_handle() - get wmi handle - * @psoc: pointer to psoc - * - * API to get wmi handle free allocated memory for target_psoc_info - * - * Return: SUCCESS on successful memory deallocation or Failure - */ -void *target_if_get_wmi_handle(struct wlan_objmgr_psoc *psoc); - /** * target_is_tgt_type_ar900b() - Check if the target type is AR900B * @target_type: target type to be checked. @@ -862,7 +852,7 @@ static inline void target_psoc_set_hif_hdl * * Return: hif_hdl */ -static inline void *target_psoc_get_num_hif_hdl +static inline void *target_psoc_get_hif_hdl (struct target_psoc_info *psoc_info) { if (psoc_info == NULL) diff --git a/target_if/core/src/target_if_main.c b/target_if/core/src/target_if_main.c index 31bf269a7659..1a8981b6189e 100644 --- a/target_if/core/src/target_if_main.c +++ b/target_if/core/src/target_if_main.c @@ -507,26 +507,6 @@ QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_SUCCESS; } -void *target_if_get_wmi_handle(struct wlan_objmgr_psoc *psoc) -{ - struct target_psoc_info *tgt_psoc_info; - - if (psoc == NULL) { - target_if_err("pSOC is NULL"); - return NULL; - } - - tgt_psoc_info = wlan_psoc_get_tgt_if_handle(psoc); - - if (tgt_psoc_info == NULL) { - target_if_err("psoc tgt_if_handle is NULL"); - return NULL; - } - - return target_psoc_get_wmi_hdl(tgt_psoc_info); - -} - bool target_is_tgt_type_ar900b(uint32_t target_type) { return target_type == TARGET_TYPE_AR900B; diff --git a/target_if/init_deinit/inc/init_deinit_ucfg.h b/target_if/init_deinit/inc/init_deinit_ucfg.h index cf25285f9e7e..aba71c4ab894 100644 --- a/target_if/init_deinit/inc/init_deinit_ucfg.h +++ b/target_if/init_deinit/inc/init_deinit_ucfg.h @@ -144,6 +144,36 @@ uint32_t ucfg_get_tgt_revision(struct wlan_objmgr_psoc *psoc); */ bool ucfg_is_target_ar900b(struct wlan_objmgr_psoc *psoc); +/** + * ucfg_get_wmi_hdl() - get wmi handle + * @psoc: pointer to psoc + * + * API to get wmi handle + * + * Return: wmi handler + */ +void *ucfg_get_wmi_hdl(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_get_htc_hdl() - get htc handler + * @psoc: pointer to psoc + * + * API to get htc handle + * + * Return: htc handler + */ +void *ucfg_get_htc_hdl(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_get_hif_hdl() - get hif handle + * @psoc: pointer to psoc + * + * API to get hif handle + * + * Return: hif handler + */ +void *ucfg_get_hif_hdl(struct wlan_objmgr_psoc *psoc); + /** * ucfg_get_pdev_wmi_handle() - get pdev wmi handle * @pdev: pointer to dev diff --git a/target_if/init_deinit/src/init_deinit_ucfg.c b/target_if/init_deinit/src/init_deinit_ucfg.c index 2913cf9a4205..e6fd1b269af2 100644 --- a/target_if/init_deinit/src/init_deinit_ucfg.c +++ b/target_if/init_deinit/src/init_deinit_ucfg.c @@ -57,8 +57,7 @@ struct wlan_psoc_target_capability_info *ucfg_get_target_cap( return NULL; } - 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 NULL; @@ -115,8 +114,7 @@ target_resource_config *ucfg_get_tgt_res_cfg(struct wlan_objmgr_psoc *psoc) return NULL; } - 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 NULL; @@ -134,8 +132,7 @@ int32_t ucfg_get_pdev_idx(struct wlan_objmgr_pdev *pdev) return 0xffffffff; } - tgt_hdl = (struct target_pdev_info *)wlan_pdev_get_tgt_if_handle( - pdev); + tgt_hdl = wlan_pdev_get_tgt_if_handle(pdev); if (!tgt_hdl) { target_if_err("target_pdev_info is null"); return 0xffffffff; @@ -153,8 +150,7 @@ uint32_t ucfg_get_tgt_type(struct wlan_objmgr_psoc *psoc) return 0; } - 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 0; @@ -188,8 +184,7 @@ uint32_t ucfg_get_tgt_version(struct wlan_objmgr_psoc *psoc) 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; @@ -207,8 +202,7 @@ uint32_t ucfg_get_tgt_revision(struct wlan_objmgr_psoc *psoc) 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; @@ -228,8 +222,7 @@ bool ucfg_is_target_ar900b(struct wlan_objmgr_psoc *psoc) return false; } - 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 false; @@ -248,6 +241,57 @@ bool ucfg_is_target_ar900b(struct wlan_objmgr_psoc *psoc) return false; } +void *ucfg_get_wmi_hdl(struct wlan_objmgr_psoc *psoc) +{ + struct target_psoc_info *tgt_hdl; + + if (!psoc) { + target_if_err("psoc is null"); + return NULL; + } + tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); + if (!tgt_hdl) { + target_if_err("target_psoc_info is null"); + return NULL; + } + + return target_psoc_get_wmi_hdl(tgt_hdl); +} + +void *ucfg_get_htc_hdl(struct wlan_objmgr_psoc *psoc) +{ + struct target_psoc_info *tgt_hdl; + + if (!psoc) { + target_if_err("psoc is null"); + return NULL; + } + tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); + if (!tgt_hdl) { + target_if_err("target_psoc_info is null"); + return NULL; + } + + return target_psoc_get_htc_hdl(tgt_hdl); +} + +void *ucfg_get_hif_hdl(struct wlan_objmgr_psoc *psoc) +{ + struct target_psoc_info *tgt_hdl; + + if (!psoc) { + target_if_err("psoc is null"); + return NULL; + } + tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); + if (!tgt_hdl) { + target_if_err("target_psoc_info is null"); + return NULL; + } + + return target_psoc_get_hif_hdl(tgt_hdl); +} + void *ucfg_get_pdev_wmi_handle(struct wlan_objmgr_pdev *pdev) { struct target_pdev_info *tgt_hdl; @@ -256,8 +300,7 @@ void *ucfg_get_pdev_wmi_handle(struct wlan_objmgr_pdev *pdev) target_if_err("pdev is null"); return NULL; } - tgt_hdl = (struct target_pdev_info *)wlan_pdev_get_tgt_if_handle( - pdev); + tgt_hdl = wlan_pdev_get_tgt_if_handle(pdev); if (!tgt_hdl) { target_if_err("target_pdev_info is null"); return NULL; diff --git a/target_if/p2p/src/target_if_p2p.c b/target_if/p2p/src/target_if_p2p.c index 000a91758692..6f6b306e5e6b 100644 --- a/target_if/p2p/src/target_if_p2p.c +++ b/target_if/p2p/src/target_if_p2p.c @@ -24,6 +24,7 @@ #include #include "target_if.h" #include "target_if_p2p.h" +#include "init_deinit_ucfg.h" static inline struct wlan_lmac_if_p2p_rx_ops * target_if_psoc_get_p2p_rx_ops(struct wlan_objmgr_psoc *psoc) @@ -167,7 +168,7 @@ QDF_STATUS target_if_p2p_register_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -190,7 +191,7 @@ QDF_STATUS target_if_p2p_register_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -213,7 +214,7 @@ QDF_STATUS target_if_p2p_unregister_lo_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -235,7 +236,7 @@ QDF_STATUS target_if_p2p_unregister_noa_event_handler( struct wlan_objmgr_psoc *psoc, void *arg) { int status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, arg:%pK", psoc, arg); @@ -258,7 +259,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, { struct p2p_ps_params cmd; QDF_STATUS status; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -299,7 +300,7 @@ QDF_STATUS target_if_p2p_set_ps(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, struct p2p_lo_start *lo_start) { - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle"); @@ -318,7 +319,7 @@ QDF_STATUS target_if_p2p_lo_start(struct wlan_objmgr_psoc *psoc, QDF_STATUS target_if_p2p_lo_stop(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id) { - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); target_if_debug("psoc:%pK, vdev_id:%d", psoc, vdev_id); @@ -335,7 +336,7 @@ QDF_STATUS target_if_p2p_set_noa(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id, bool disable_noa) { struct vdev_set_params param; - wmi_unified_t wmi_handle = target_if_get_wmi_handle(psoc); + wmi_unified_t wmi_handle = ucfg_get_wmi_hdl(psoc); if (!wmi_handle) { target_if_err("Invalid wmi handle");