From 03d1e2c4285b4aa2b48aee3058c2f97d8114ada7 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Wed, 31 Oct 2018 08:32:02 -0700 Subject: [PATCH] qcacld-3.0: Introduce sap_get_mac_context() Currently the macro CDS_GET_HAL_CB() is used throughout the SAP to retrieve an opaque handle for the MAC context. This name is an anachronism given that the HAL layer was moved to firmware many generations ago. In addition, since the SAP module is internal to the UMAC, it should normally not be dealing with the opaque handle but should instead be dealing directly with the MAC context. Finally, per the coding style, "inline functions are preferable to macros resembling functions." To address these issues introduce sap_get_mac_context(), a new inline function, to replace the current usage of CDS_GET_HAL_CB(). Subsequent changes will actually perform the replacement. Change-Id: I53160f7f5a315516f5348baea8cc7945483431bd CRs-Fixed: 2346181 --- core/sap/src/sap_internal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index 70a8f31ddaee..2d63de5557e4 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -279,6 +279,18 @@ typedef struct sWLAN_SAPEvent { /*---------------------------------------------------------------------------- * Function Declarations and Documentation * -------------------------------------------------------------------------*/ + +/** + * sap_get_mac_context() - Get a pointer to the global MAC context + * + * Return: pointer to the global MAC context, or NULL if the MAC + * context is no longer registered + */ +static inline struct mac_context *sap_get_mac_context(void) +{ + return cds_get_context(QDF_MODULE_ID_PE); +} + QDF_STATUS wlansap_context_get(struct sap_context *ctx); void wlansap_context_put(struct sap_context *ctx);