qcacmn: Redefine pdev and vdev param to remove CONFIG_MCL

Convert pdev and vdev param conversion array to pointers
and allocate them only if conversion is required.Use run-time
NULL check of pdev and vdev param pointers for conversion
and remove CONFIG_MCL compiler flag.

CRs-Fixed: 2393422
Change-Id: Ica1c81f5f3c3a4b7e31dcb70c63471898c36933d
This commit is contained in:
Surya Prakash Raajen
2019-02-21 19:24:35 +05:30
committed by nshrivas
parent 5d32743e83
commit 80638517c2
4 changed files with 59 additions and 62 deletions

View File

@@ -2397,29 +2397,6 @@ static inline void wmi_interface_logging_init(struct wmi_unified *wmi_handle,
}
#endif
/**
* wmi_target_params_init: Target specific params init
* @param wmi_soc: Pointer to wmi soc object
* @param wmi_handle: Pointer to wmi handle object
*
* return: None
*/
#ifndef CONFIG_MCL
static inline void wmi_target_params_init(struct wmi_soc *soc,
struct wmi_unified *wmi_handle)
{
wmi_handle->pdev_param = soc->pdev_param;
wmi_handle->vdev_param = soc->vdev_param;
wmi_handle->services = soc->services;
}
#else
static inline void wmi_target_params_init(struct wmi_soc *soc,
struct wmi_unified *wmi_handle)
{
wmi_handle->services = soc->services;
}
#endif
/**
* wmi_unified_get_pdev_handle: Get WMI SoC handle
* @param wmi_soc: Pointer to wmi soc object
@@ -2458,7 +2435,7 @@ void *wmi_unified_get_pdev_handle(struct wmi_soc *soc, uint32_t pdev_idx)
goto error;
}
wmi_handle->wmi_events = soc->wmi_events;
wmi_target_params_init(soc, wmi_handle);
wmi_handle->services = soc->services;
wmi_handle->soc = soc;
wmi_interface_logging_init(wmi_handle, pdev_idx);
qdf_atomic_init(&wmi_handle->pending_cmds);
@@ -2566,8 +2543,23 @@ void *wmi_unified_attach(void *scn_handle,
wmi_handle->event_handler = soc->event_handler;
wmi_handle->ctx = soc->ctx;
wmi_handle->wmi_events = soc->wmi_events;
wmi_target_params_init(soc, wmi_handle);
wmi_handle->services = soc->services;
wmi_handle->scn_handle = scn_handle;
if (param->enable_vdev_pdev_param_conversion) {
if (wmi_pdev_param_max > SIZE_MAX / sizeof(uint32_t))
goto error;
soc->pdev_param = qdf_mem_malloc(
wmi_pdev_param_max * sizeof(uint32_t));
if (!soc->pdev_param)
goto error;
if (wmi_vdev_param_max > SIZE_MAX / sizeof(uint32_t))
goto error;
soc->vdev_param = qdf_mem_malloc(
wmi_vdev_param_max * sizeof(uint32_t));
if (!soc->vdev_param)
goto error;
}
soc->scn_handle = scn_handle;
qdf_atomic_init(&wmi_handle->pending_cmds);
qdf_atomic_init(&wmi_handle->is_target_suspended);
@@ -2618,6 +2610,14 @@ void *wmi_unified_attach(void *scn_handle,
return wmi_handle;
error:
if (soc->pdev_param) {
qdf_mem_free(soc->pdev_param);
soc->pdev_param = NULL;
}
if (soc->vdev_param) {
qdf_mem_free(soc->vdev_param);
soc->vdev_param = NULL;
}
qdf_mem_free(soc);
qdf_mem_free(wmi_handle);
@@ -2670,6 +2670,16 @@ void wmi_unified_detach(struct wmi_unified *wmi_handle)
}
qdf_spinlock_destroy(&soc->ctx_lock);
if (soc->pdev_param) {
qdf_mem_free(soc->pdev_param);
soc->pdev_param = NULL;
}
if (soc->vdev_param) {
qdf_mem_free(soc->vdev_param);
soc->vdev_param = NULL;
}
if (soc->wmi_service_bitmap) {
qdf_mem_free(soc->wmi_service_bitmap);
soc->wmi_service_bitmap = NULL;