mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 16:16:15 -04:00
qcacld-3.0: Remove cds_[alloc|free]_context() parameter
Currently cds_alloc_context() & cds_free_context() take a CDS context parameter. However CDS already maintains its own context, hence this parameter introduces an unnecessary coupling, so remove it. Change-Id: I4501a0fea7acc7b4a764b0d425da386922b93bcb CRs-Fixed: 2109265
This commit is contained in:
parent
ff6addf320
commit
adb3b1cadf
4 changed files with 29 additions and 60 deletions
|
|
@ -547,8 +547,8 @@ QDF_STATUS ol_cds_init(qdf_device_t qdf_dev, void *hif_ctx)
|
|||
if (NO_BMI)
|
||||
return QDF_STATUS_SUCCESS; /* no BMI for Q6 bring up */
|
||||
|
||||
status = cds_alloc_context(cds_get_global_context(), QDF_MODULE_ID_BMI,
|
||||
(void **)&ol_info, sizeof(*ol_info));
|
||||
status = cds_alloc_context(QDF_MODULE_ID_BMI,
|
||||
(void **)&ol_info, sizeof(*ol_info));
|
||||
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
BMI_ERR("%s: CDS Allocation failed for ol_bmi context",
|
||||
|
|
@ -580,5 +580,5 @@ void ol_cds_free(void)
|
|||
if (NO_BMI)
|
||||
return;
|
||||
|
||||
cds_free_context(cds_get_global_context(), QDF_MODULE_ID_BMI, ol_info);
|
||||
cds_free_context(QDF_MODULE_ID_BMI, ol_info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,11 +327,10 @@ uint8_t cds_get_datapath_handles(void **soc, struct cdp_pdev **pdev,
|
|||
struct cdp_vdev **vdev, uint8_t sessionId);
|
||||
v_CONTEXT_t cds_get_global_context(void);
|
||||
|
||||
QDF_STATUS cds_alloc_context(void *p_cds_context, QDF_MODULE_ID moduleID,
|
||||
void **ppModuleContext, uint32_t size);
|
||||
QDF_STATUS cds_alloc_context(QDF_MODULE_ID moduleID, void **ppModuleContext,
|
||||
uint32_t size);
|
||||
|
||||
QDF_STATUS cds_free_context(void *p_cds_context, QDF_MODULE_ID moduleID,
|
||||
void *pModuleContext);
|
||||
QDF_STATUS cds_free_context(QDF_MODULE_ID moduleID, void *pModuleContext);
|
||||
|
||||
QDF_STATUS cds_set_context(QDF_MODULE_ID module_id, void *context);
|
||||
|
||||
|
|
|
|||
|
|
@ -1398,7 +1398,6 @@ void cds_clear_fw_state(enum cds_fw_state state)
|
|||
|
||||
/**
|
||||
* cds_alloc_context() - allocate a context within the CDS global Context
|
||||
* @p_cds_context: pointer to the global Vos context
|
||||
* @moduleId: module ID who's context area is being allocated.
|
||||
* @ppModuleContext: pointer to location where the pointer to the
|
||||
* allocated context is returned. Note this output pointer
|
||||
|
|
@ -1410,60 +1409,46 @@ void cds_clear_fw_state(enum cds_fw_state state)
|
|||
*
|
||||
* Return: QDF status
|
||||
*/
|
||||
QDF_STATUS cds_alloc_context(void *p_cds_context, QDF_MODULE_ID moduleID,
|
||||
QDF_STATUS cds_alloc_context(QDF_MODULE_ID moduleID,
|
||||
void **ppModuleContext, uint32_t size)
|
||||
{
|
||||
void **pGpModContext = NULL;
|
||||
|
||||
if (p_cds_context == NULL) {
|
||||
if (!gp_cds_context) {
|
||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
|
||||
"%s: cds context is null", __func__);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if ((gp_cds_context != p_cds_context) || (ppModuleContext == NULL)) {
|
||||
if (!ppModuleContext) {
|
||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
|
||||
"%s: context mismatch or null param passed",
|
||||
"%s: null param passed",
|
||||
__func__);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
switch (moduleID) {
|
||||
case QDF_MODULE_ID_WMA:
|
||||
{
|
||||
pGpModContext = &(gp_cds_context->pWMAContext);
|
||||
break;
|
||||
}
|
||||
|
||||
case QDF_MODULE_ID_HIF:
|
||||
{
|
||||
pGpModContext = &(gp_cds_context->pHIFContext);
|
||||
break;
|
||||
}
|
||||
|
||||
case QDF_MODULE_ID_BMI:
|
||||
{
|
||||
pGpModContext = &(gp_cds_context->g_ol_context);
|
||||
break;
|
||||
}
|
||||
|
||||
case QDF_MODULE_ID_EPPING:
|
||||
case QDF_MODULE_ID_SME:
|
||||
case QDF_MODULE_ID_PE:
|
||||
case QDF_MODULE_ID_HDD:
|
||||
case QDF_MODULE_ID_HDD_SOFTAP:
|
||||
default:
|
||||
{
|
||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
|
||||
"%s: Module ID %i "
|
||||
"does not have its context allocated by CDS",
|
||||
"%s: Module ID %i does not have its context allocated by CDS",
|
||||
__func__, moduleID);
|
||||
QDF_ASSERT(0);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != *pGpModContext) {
|
||||
if (*pGpModContext) {
|
||||
/* Context has already been allocated!
|
||||
* Prevent double allocation
|
||||
*/
|
||||
|
|
@ -1477,9 +1462,9 @@ QDF_STATUS cds_alloc_context(void *p_cds_context, QDF_MODULE_ID moduleID,
|
|||
|
||||
*ppModuleContext = qdf_mem_malloc(size);
|
||||
|
||||
if (*ppModuleContext == NULL) {
|
||||
if (!*ppModuleContext) {
|
||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
|
||||
"%s: Failed to " "allocate Context for module ID %i",
|
||||
"%s: Failed to allocate Context for module ID %i",
|
||||
__func__, moduleID);
|
||||
QDF_ASSERT(0);
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
|
|
@ -1530,7 +1515,6 @@ QDF_STATUS cds_set_context(QDF_MODULE_ID module_id, void *context)
|
|||
/**
|
||||
* cds_free_context() - free an allocated context within the
|
||||
* CDS global Context
|
||||
* @p_cds_context: pointer to the global Vos context
|
||||
* @moduleId: module ID who's context area is being free
|
||||
* @pModuleContext: pointer to module context area to be free'd.
|
||||
*
|
||||
|
|
@ -1539,50 +1523,40 @@ QDF_STATUS cds_set_context(QDF_MODULE_ID module_id, void *context)
|
|||
*
|
||||
* Return: QDF status
|
||||
*/
|
||||
QDF_STATUS cds_free_context(void *p_cds_context, QDF_MODULE_ID moduleID,
|
||||
void *pModuleContext)
|
||||
QDF_STATUS cds_free_context(QDF_MODULE_ID moduleID, void *pModuleContext)
|
||||
{
|
||||
void **pGpModContext = NULL;
|
||||
|
||||
if ((p_cds_context == NULL) || (gp_cds_context != p_cds_context) ||
|
||||
(pModuleContext == NULL)) {
|
||||
if (!gp_cds_context) {
|
||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
|
||||
"%s: Null params or context mismatch", __func__);
|
||||
"%s: cds context is null", __func__);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (!pModuleContext) {
|
||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
|
||||
"%s: Null param", __func__);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
switch (moduleID) {
|
||||
case QDF_MODULE_ID_WMA:
|
||||
{
|
||||
pGpModContext = &(gp_cds_context->pWMAContext);
|
||||
break;
|
||||
}
|
||||
|
||||
case QDF_MODULE_ID_HIF:
|
||||
{
|
||||
pGpModContext = &(gp_cds_context->pHIFContext);
|
||||
break;
|
||||
}
|
||||
|
||||
case QDF_MODULE_ID_TXRX:
|
||||
{
|
||||
pGpModContext = (void **)&(gp_cds_context->pdev_txrx_ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
case QDF_MODULE_ID_BMI:
|
||||
{
|
||||
pGpModContext = &(gp_cds_context->g_ol_context);
|
||||
break;
|
||||
}
|
||||
|
||||
case QDF_MODULE_ID_EPPING:
|
||||
case QDF_MODULE_ID_HDD:
|
||||
case QDF_MODULE_ID_SME:
|
||||
case QDF_MODULE_ID_PE:
|
||||
case QDF_MODULE_ID_HDD_SOFTAP:
|
||||
default:
|
||||
{
|
||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
|
||||
"%s: Module ID %i "
|
||||
"does not have its context allocated by CDS",
|
||||
|
|
@ -1590,13 +1564,11 @@ QDF_STATUS cds_free_context(void *p_cds_context, QDF_MODULE_ID moduleID,
|
|||
QDF_ASSERT(0);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == *pGpModContext) {
|
||||
/* Context has not been allocated or freed already! */
|
||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
|
||||
"%s: Module ID %i "
|
||||
"context has not been allocated or freed already",
|
||||
"%s: Module ID %i context has not been allocated or freed already",
|
||||
__func__, moduleID);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
|
@ -1607,8 +1579,7 @@ QDF_STATUS cds_free_context(void *p_cds_context, QDF_MODULE_ID moduleID,
|
|||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (pModuleContext != NULL)
|
||||
qdf_mem_free(pModuleContext);
|
||||
qdf_mem_free(pModuleContext);
|
||||
|
||||
*pGpModContext = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -2250,9 +2250,9 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
|
|||
}
|
||||
|
||||
/* Alloc memory for WMA Context */
|
||||
qdf_status = cds_alloc_context(cds_context, QDF_MODULE_ID_WMA,
|
||||
qdf_status = cds_alloc_context(QDF_MODULE_ID_WMA,
|
||||
(void **)&wma_handle,
|
||||
sizeof(t_wma_handle));
|
||||
sizeof(*wma_handle));
|
||||
|
||||
if (qdf_status != QDF_STATUS_SUCCESS) {
|
||||
WMA_LOGE("%s: Memory allocation failed for wma_handle",
|
||||
|
|
@ -2778,7 +2778,7 @@ err_wma_handle:
|
|||
qdf_wake_lock_destroy(&wma_handle->roam_ho_wl);
|
||||
}
|
||||
|
||||
cds_free_context(cds_context, QDF_MODULE_ID_WMA, wma_handle);
|
||||
cds_free_context(QDF_MODULE_ID_WMA, wma_handle);
|
||||
|
||||
WMA_LOGD("%s: Exit", __func__);
|
||||
|
||||
|
|
@ -3619,8 +3619,7 @@ QDF_STATUS wma_wmi_service_close(void)
|
|||
qdf_mem_free(wma_handle->interfaces);
|
||||
|
||||
/* free the wma_handle */
|
||||
cds_free_context(wma_handle->cds_context, QDF_MODULE_ID_WMA,
|
||||
wma_handle);
|
||||
cds_free_context(QDF_MODULE_ID_WMA, wma_handle);
|
||||
|
||||
qdf_mem_free(((p_cds_contextType) cds_ctx)->cfg_ctx);
|
||||
WMA_LOGD("%s: Exit", __func__);
|
||||
|
|
|
|||
Loading…
Reference in a new issue