Parcourir la source

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
Jeff Johnson il y a 6 ans
Parent
commit
4ea7974ce3

+ 6 - 0
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);

+ 4 - 13
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");

+ 0 - 6
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.

+ 22 - 1
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

+ 7 - 8
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;
 }