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
This commit is contained in:
Himanshu Batra
2019-06-07 13:18:43 +05:30
committed by nshrivas
parent 3863721077
commit 556930bba9
6 changed files with 63 additions and 23 deletions

View File

@@ -1528,14 +1528,13 @@ static inline int32_t target_pdev_get_phy_idx
static inline struct wmi_unified *GET_WMI_HDL_FROM_PSOC( static inline struct wmi_unified *GET_WMI_HDL_FROM_PSOC(
struct wlan_objmgr_psoc *psoc) struct wlan_objmgr_psoc *psoc)
{ {
void *tgt_if_handle; struct target_psoc_info *tgt_if_handle;
if (psoc) { if (psoc) {
tgt_if_handle = psoc->tgt_if_handle; tgt_if_handle = psoc->tgt_if_handle;
if (tgt_if_handle) if (tgt_if_handle)
return (target_psoc_get_wmi_hdl( return target_psoc_get_wmi_hdl(tgt_if_handle);
(struct target_psoc_info *)tgt_if_handle));
else else
return NULL; 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( static inline struct wmi_unified *GET_WMI_HDL_FROM_PDEV(
struct wlan_objmgr_pdev *pdev) struct wlan_objmgr_pdev *pdev)
{ {
void *tgt_if_handle; struct target_pdev_info *tgt_if_handle;
if (pdev) { if (pdev) {
tgt_if_handle = pdev->tgt_if_handle; tgt_if_handle = pdev->tgt_if_handle;

View File

@@ -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_ */

View File

@@ -240,7 +240,7 @@ void lmac_set_htc_hdl(struct wlan_objmgr_psoc *psoc,
target_if_err("psoc is null"); target_if_err("psoc is null");
return; 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) { if (!tgt_hdl) {
target_if_err("target_psoc_info is null"); target_if_err("target_psoc_info is null");
return; return;

View File

@@ -55,8 +55,7 @@ static int init_deinit_service_ready_event_handler(ol_scn_t scn_handle,
return -EINVAL; return -EINVAL;
} }
tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle( tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
psoc);
if (!tgt_hdl) { if (!tgt_hdl) {
target_if_err("target_psoc_info is null in service ready ev"); target_if_err("target_psoc_info is null in service ready ev");
return -EINVAL; return -EINVAL;
@@ -208,8 +207,7 @@ static int init_deinit_service_ext_ready_event_handler(ol_scn_t scn_handle,
return -EINVAL; return -EINVAL;
} }
tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle( tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
psoc);
if (!tgt_hdl) { if (!tgt_hdl) {
target_if_err("target_psoc_info is null in service ready ev"); target_if_err("target_psoc_info is null in service ready ev");
return -EINVAL; return -EINVAL;
@@ -332,8 +330,7 @@ static int init_deinit_service_available_handler(ol_scn_t scn_handle,
return -EINVAL; return -EINVAL;
} }
tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle( tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
psoc);
if (!tgt_hdl) { if (!tgt_hdl) {
target_if_err("target_psoc_info is null"); target_if_err("target_psoc_info is null");
return -EINVAL; return -EINVAL;
@@ -382,8 +379,7 @@ static int init_deinit_ready_event_handler(ol_scn_t scn_handle,
return -EINVAL; return -EINVAL;
} }
tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle( tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
psoc);
if (!tgt_hdl) { if (!tgt_hdl) {
target_if_err("target_psoc_info is null"); target_if_err("target_psoc_info is null");
return -EINVAL; return -EINVAL;
@@ -534,8 +530,7 @@ QDF_STATUS init_deinit_register_tgt_psoc_ev_handlers(
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
tgt_hdl = (struct target_psoc_info *)wlan_psoc_get_tgt_if_handle( tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
psoc);
if (!tgt_hdl) { if (!tgt_hdl) {
target_if_err("target_psoc_info null in register wmi hadler"); target_if_err("target_psoc_info null in register wmi hadler");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;

View File

@@ -24,6 +24,7 @@
#include <wlan_objmgr_cmn.h> #include <wlan_objmgr_cmn.h>
#include "wlan_objmgr_psoc_obj.h" #include "wlan_objmgr_psoc_obj.h"
#include <target_if_pub.h>
/* STATUS: scanning */ /* STATUS: scanning */
#define WLAN_PDEV_F_SCAN 0x00000001 #define WLAN_PDEV_F_SCAN 0x00000001
@@ -203,7 +204,7 @@ struct wlan_objmgr_pdev {
void *pdev_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS]; void *pdev_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS];
QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS]; QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS];
WLAN_OBJ_STATE obj_state; WLAN_OBJ_STATE obj_state;
void *tgt_if_handle; target_pdev_info_t *tgt_if_handle;
void *dp_handle; void *dp_handle;
qdf_spinlock_t pdev_lock; qdf_spinlock_t pdev_lock;
}; };
@@ -832,8 +833,9 @@ uint8_t wlan_objmgr_pdev_get_pdev_id(struct wlan_objmgr_pdev *pdev)
* *
* Return: None * Return: None
*/ */
static inline void wlan_pdev_set_tgt_if_handle(struct wlan_objmgr_pdev *pdev, static inline
void *tgt_if_handle) 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 */ /* This API is invoked with lock acquired, do not add log prints */
if (!pdev) if (!pdev)
@@ -850,7 +852,8 @@ static inline void wlan_pdev_set_tgt_if_handle(struct wlan_objmgr_pdev *pdev,
* *
* Return: target interface handle * 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) if (!pdev)
return NULL; return NULL;

View File

@@ -25,6 +25,7 @@
#include "wlan_objmgr_cmn.h" #include "wlan_objmgr_cmn.h"
#include "wlan_objmgr_debug.h" #include "wlan_objmgr_debug.h"
#include "wlan_lmac_if_def.h" #include "wlan_lmac_if_def.h"
#include <target_if_pub.h>
#define REG_DMN_CH144 0x0001 #define REG_DMN_CH144 0x0001
#define REG_DMN_ENTREPRISE 0x0002 #define REG_DMN_ENTREPRISE 0x0002
@@ -332,7 +333,7 @@ struct wlan_objmgr_psoc {
void *soc_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS]; void *soc_comp_priv_obj[WLAN_UMAC_MAX_COMPONENTS];
QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS]; QDF_STATUS obj_status[WLAN_UMAC_MAX_COMPONENTS];
WLAN_OBJ_STATE obj_state; WLAN_OBJ_STATE obj_state;
void *tgt_if_handle; target_psoc_info_t *tgt_if_handle;
void *dp_handle; void *dp_handle;
qdf_spinlock_t psoc_lock; 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 * Return: None
*/ */
static inline void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc, static inline
void *tgt_if_handle) void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc,
target_psoc_info_t *tgt_if_handle)
{ {
if (!psoc) if (!psoc)
return; return;
@@ -1241,7 +1243,8 @@ static inline void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc,
* *
* Return: target interface handle * 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) if (!psoc)
return NULL; return NULL;