From 4ea7974ce3db789748c0f11191e7a76d1844bf0a Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Sat, 21 Jul 2018 21:57:24 -0700 Subject: [PATCH] qcacld-3.0: Refine the mac_start() API The mac_start() API currently specifies a void pointer for the "start params" parameter. But both mac_start() and its caller must agree on the type of this structure, so replace the void pointer with the actual struct pointer. In the process rename that struct to comply with the coding style and relocate it to be a part of the MAC Init API. Change-Id: I7fc62abbb17d214551ca6ff0cda8b76d218280e3 CRs-Fixed: 2290807 --- core/cds/inc/cds_api.h | 6 +++++ core/cds/src/cds_api.c | 17 ++++---------- core/mac/inc/ani_global.h | 6 ----- core/mac/inc/mac_init_api.h | 23 ++++++++++++++++++- .../sys/legacy/src/system/src/mac_init_api.c | 15 ++++++------ 5 files changed, 39 insertions(+), 28 deletions(-) diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h index 39bb7c59d542..9e652303512b 100644 --- a/core/cds/inc/cds_api.h +++ b/core/cds/inc/cds_api.h @@ -403,6 +403,12 @@ QDF_STATUS cds_open(struct wlan_objmgr_psoc *psoc); */ QDF_STATUS cds_dp_open(struct wlan_objmgr_psoc *psoc); +/** + * cds_enable() - start/enable cds module + * @psoc: Psoc pointer + * + * Return: QDF status + */ QDF_STATUS cds_enable(struct wlan_objmgr_psoc *psoc); QDF_STATUS cds_disable(struct wlan_objmgr_psoc *psoc); diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 8c223719beb7..c828a36721e0 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -842,17 +842,10 @@ exit_with_status: return status; } -/** - * cds_enable() - start/enable cds module - * @psoc: Psoc pointer - * @cds_context: CDS context - * - * Return: QDF status - */ QDF_STATUS cds_enable(struct wlan_objmgr_psoc *psoc) { QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; - tHalMacStartParameters halStartParams; + struct mac_start_params mac_params; /* We support only one instance for now ... */ if (!gp_cds_context) { @@ -879,11 +872,9 @@ QDF_STATUS cds_enable(struct wlan_objmgr_psoc *psoc) cds_info("wma correctly started"); /* Start the MAC */ - qdf_mem_zero(&halStartParams, - sizeof(tHalMacStartParameters)); - - /* Start the MAC */ - qdf_status = mac_start(gp_cds_context->mac_context, &halStartParams); + qdf_mem_zero(&mac_params, sizeof(mac_params)); + mac_params.driver_type = QDF_DRIVER_TYPE_PRODUCTION; + qdf_status = mac_start(gp_cds_context->mac_context, &mac_params); if (QDF_STATUS_SUCCESS != qdf_status) { cds_alert("Failed to start MAC"); diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index d35b1510cc22..f3f94781fd33 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -779,12 +779,6 @@ typedef struct sRrmContext { tRrmPEContext rrmPEContext; } tRrmContext, *tpRrmContext; -typedef struct sHalMacStartParameters { - /* parameters for the Firmware */ - enum qdf_driver_type driverType; - -} tHalMacStartParameters; - /** * enum auth_tx_ack_status - Indicate TX status of AUTH * @LIM_AUTH_ACK_NOT_RCD : Default status while waiting for ack status. diff --git a/core/mac/inc/mac_init_api.h b/core/mac/inc/mac_init_api.h index edd00d56b44b..4d7ac9dc34e0 100644 --- a/core/mac/inc/mac_init_api.h +++ b/core/mac/inc/mac_init_api.h @@ -32,7 +32,28 @@ #include "ani_global.h" #include "sir_types.h" -QDF_STATUS mac_start(tHalHandle hHal, void *pHalMacStartParams); +/** + * struct mac_start_params - parameters needed when starting the MAC + * @driver_type: Operating mode of the driver + */ +struct mac_start_params { + enum qdf_driver_type driver_type; +}; + +/** + * mac_start() - Start all MAC modules + * @mac_handle: Opaque handle to the MAC context + * @params: Parameters needed to start the MAC + * + * This function is called to start MAC. This function will start all + * the mac modules. + * + * Return: QDF_STATUS_SUCCESS if the MAC was successfully started. Any + * other value means that there was an issue with starting the + * MAC and the MAC should not be considered operational. + */ +QDF_STATUS mac_start(mac_handle_t mac_handle, + struct mac_start_params *params); /** * mac_stop() - Stop all MAC modules diff --git a/core/mac/src/sys/legacy/src/system/src/mac_init_api.c b/core/mac/src/sys/legacy/src/system/src/mac_init_api.c index 5d41df2fa6a0..e154fc624315 100644 --- a/core/mac/src/sys/legacy/src/system/src/mac_init_api.c +++ b/core/mac/src/sys/legacy/src/system/src/mac_init_api.c @@ -41,23 +41,22 @@ static tAniSirGlobal global_mac_context; -QDF_STATUS mac_start(tHalHandle hHal, void *pHalMacStartParams) +QDF_STATUS mac_start(mac_handle_t mac_handle, + struct mac_start_params *params) { QDF_STATUS status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac = (tpAniSirGlobal) hHal; + tpAniSirGlobal mac = MAC_CONTEXT(mac_handle); - if (NULL == pMac) { + if (!mac || !params) { QDF_ASSERT(0); status = QDF_STATUS_E_FAILURE; return status; } - pMac->gDriverType = - ((tHalMacStartParameters *) pHalMacStartParams)->driverType; + mac->gDriverType = params->driver_type; - if (ANI_DRIVER_TYPE(pMac) != QDF_DRIVER_TYPE_MFG) { - status = pe_start(pMac); - } + if (ANI_DRIVER_TYPE(mac) != QDF_DRIVER_TYPE_MFG) + status = pe_start(mac); return status; }