From 556930bba9300b05e1ddc2442e8dbe97c0218936 Mon Sep 17 00:00:00 2001 From: Himanshu Batra Date: Fri, 7 Jun 2019 13:18:43 +0530 Subject: [PATCH] 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 --- target_if/core/inc/target_if.h | 7 ++-- target_if/dispatcher/inc/target_if_pub.h | 40 +++++++++++++++++++ target_if/init_deinit/src/init_deinit_lmac.c | 2 +- .../init_deinit/src/init_event_handler.c | 15 +++---- .../obj_mgr/inc/wlan_objmgr_pdev_obj.h | 11 +++-- .../obj_mgr/inc/wlan_objmgr_psoc_obj.h | 11 +++-- 6 files changed, 63 insertions(+), 23 deletions(-) create mode 100644 target_if/dispatcher/inc/target_if_pub.h diff --git a/target_if/core/inc/target_if.h b/target_if/core/inc/target_if.h index 2780077b42..89830ec8ad 100644 --- a/target_if/core/inc/target_if.h +++ b/target_if/core/inc/target_if.h @@ -1528,14 +1528,13 @@ static inline int32_t target_pdev_get_phy_idx 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_PSOC( 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 0000000000..84a24b7c26 --- /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 2249cd59bd..e2f8fc4f52 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 @@ void lmac_set_htc_hdl(struct wlan_objmgr_psoc *psoc, 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 2e680b6601..f769386285 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 @@ static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle, 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 @@ static int init_deinit_service_ext_ready_event_handler(ol_scn_t scn_handle, 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 @@ static int init_deinit_service_available_handler(ol_scn_t scn_handle, 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 @@ static int init_deinit_ready_event_handler(ol_scn_t scn_handle, 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 @@ QDF_STATUS init_deinit_register_tgt_psoc_ev_handlers( 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 af52c1a599..0067752000 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 #include "wlan_objmgr_psoc_obj.h" +#include /* STATUS: scanning */ #define WLAN_PDEV_F_SCAN 0x00000001 @@ -203,7 +204,7 @@ struct wlan_objmgr_pdev { 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 @@ uint8_t wlan_objmgr_pdev_get_pdev_id(struct wlan_objmgr_pdev *pdev) * * 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 @@ static inline void wlan_pdev_set_tgt_if_handle(struct wlan_objmgr_pdev *pdev, * * 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 f7eea2d6a4..f44eb769e0 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 #define REG_DMN_CH144 0x0001 #define REG_DMN_ENTREPRISE 0x0002 @@ -332,7 +333,7 @@ struct wlan_objmgr_psoc { 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 @@ static inline uint8_t wlan_psoc_get_pdev_count(struct wlan_objmgr_psoc *psoc) * * 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 @@ static inline void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc, * * 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;