summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMingcheng Zhu <mingchen@qca.qualcomm.com>2014-11-06 20:16:22 -0800
committerAnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com>2014-11-08 18:21:47 +0530
commitfb27f6cf7ffeccf403eaddc427592a877d3d7e1b (patch)
tree3872d4f25bab383cd7bf664758a206fba942f24c
parent739e8a830aabd6dbe9e34dbae1fa581f40c3c900 (diff)
qcacld-new: fix the adf_ctx creation/initialization issue
Current implementation is to create and initialize adf_ctx inside hdd_wlan_startup function. This implemplementation has an issue that HIF cannot unmap and free socket buffers if hdd_wlan_startup failed. The fix is to move the adf_ctx craetion and initialization to hif_pci_prob. The adf_ctx deinitialization is also moved from HDD to HIF alyer. vos_mem_init function is also moved to hdd_driver_init so that HIF can use VOSS memory debug feature. Change-Id: I204ef0527949bf2de4d57b5953b66439306f7187 CRs-Fixed: 752044
-rw-r--r--CORE/EPPING/src/epping_main.c21
-rw-r--r--CORE/HDD/src/wlan_hdd_early_suspend.c12
-rwxr-xr-xCORE/HDD/src/wlan_hdd_main.c28
3 files changed, 4 insertions, 57 deletions
diff --git a/CORE/EPPING/src/epping_main.c b/CORE/EPPING/src/epping_main.c
index cfd8338b5ed1..4193c2dcc289 100644
--- a/CORE/EPPING/src/epping_main.c
+++ b/CORE/EPPING/src/epping_main.c
@@ -240,7 +240,6 @@ void epping_exit(v_CONTEXT_t pVosContext)
void epping_driver_exit(v_CONTEXT_t pVosContext)
{
epping_context_t *pEpping_ctx;
- adf_os_device_t adf_ctx;
pr_info("%s: unloading driver\n", __func__);
@@ -260,12 +259,6 @@ void epping_driver_exit(v_CONTEXT_t pVosContext)
vos_set_load_unload_in_progress(VOS_MODULE_ID_VOSS, TRUE);
}
hif_unregister_driver();
- /*
- * ADF context cannot be freed in hdd_wlan_exit for discrete
- * as it is needed in PCI remove. So free it here.
- */
- adf_ctx = vos_get_context(VOS_MODULE_ID_ADF, pVosContext);
- vos_mem_free(adf_ctx);
vos_preClose( &pVosContext );
#ifdef MEMORY_DEBUG
vos_mem_exit();
@@ -297,10 +290,10 @@ int epping_wlan_startup(struct device *parent_dev, v_VOID_t *hif_sc)
int ret = 0;
epping_context_t *pEpping_ctx = NULL;
VosContextType *pVosContext = NULL;
- adf_os_device_t adf_ctx;
HTC_INIT_INFO htcInfo;
struct ol_softc *scn;
tSirMacAddr adapter_macAddr;
+ adf_os_device_t adf_ctx;
EPPING_LOG(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Enter", __func__);
@@ -325,22 +318,10 @@ int epping_wlan_startup(struct device *parent_dev, v_VOID_t *hif_sc)
pEpping_ctx->parent_dev = (void *)parent_dev;
epping_get_dummy_mac_addr(adapter_macAddr);
- /* Initialize the adf_ctx handle */
- adf_ctx = vos_mem_malloc(sizeof(*adf_ctx));
-
- if (!adf_ctx) {
- EPPING_LOG(VOS_TRACE_LEVEL_FATAL,
- "%s: Failed to allocate adf_ctx", __func__);
- ret = -1;
- return ret;
- }
- vos_mem_zero(adf_ctx, sizeof(*adf_ctx));
- hif_init_adf_ctx(adf_ctx, hif_sc);
((VosContextType*)pVosContext)->pHIFContext = hif_sc;
/* store target type and target version info in hdd ctx */
pEpping_ctx->target_type = ((struct ol_softc *)hif_sc)->target_type;
- ((VosContextType*)(pVosContext))->adf_ctx = adf_ctx;
/* Initialize the timer module */
vos_timer_module_init();
diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c
index dbfdf3573291..686c54e9fb04 100644
--- a/CORE/HDD/src/wlan_hdd_early_suspend.c
+++ b/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -1938,7 +1938,6 @@ VOS_STATUS hdd_wlan_re_init(void *hif_sc)
hdd_context_t *pHddCtx = NULL;
eHalStatus halStatus;
- adf_os_device_t adf_ctx;
hdd_adapter_t *pAdapter;
int i;
hdd_prevent_suspend();
@@ -1968,18 +1967,7 @@ VOS_STATUS hdd_wlan_re_init(void *hif_sc)
goto err_re_init;
}
- /* Initialize the adf_ctx handle */
- adf_ctx = ((VosContextType*)(pVosContext))->adf_ctx;
-
- if (!adf_ctx) {
- hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Failed to get adf_ctx", __func__);
- goto err_re_init;
- }
- vos_mem_zero(adf_ctx, sizeof(*adf_ctx));
-
- hif_init_adf_ctx(adf_ctx, hif_sc);
((VosContextType*)pVosContext)->pHIFContext = hif_sc;
- ((VosContextType*)(pVosContext))->adf_ctx = adf_ctx;
/* The driver should always be initialized in STA mode after SSR */
hdd_set_conparam(0);
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index ad04bde2bd44..c0553d63de2d 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -11592,7 +11592,6 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc)
int i;
struct wiphy *wiphy;
unsigned long rc;
- adf_os_device_t adf_ctx;
tSmeThermalParams thermalParam;
tSirTxPowerLimit *hddtxlimit;
#ifdef FEATURE_WLAN_CH_AVOID
@@ -11685,20 +11684,10 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc)
goto err_config;
}
- /* Initialize the adf_ctx handle */
- adf_ctx = vos_mem_malloc(sizeof(*adf_ctx));
-
- if (!adf_ctx) {
- hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Failed to allocate adf_ctx", __func__);
- goto err_config;
- }
- vos_mem_zero(adf_ctx, sizeof(*adf_ctx));
- hif_init_adf_ctx(adf_ctx, hif_sc);
((VosContextType*)pVosContext)->pHIFContext = hif_sc;
/* store target type and target version info in hdd ctx */
pHddCtx->target_type = ((struct ol_softc *)hif_sc)->target_type;
- ((VosContextType*)(pVosContext))->adf_ctx = adf_ctx;
pHddCtx->current_intf_count=0;
pHddCtx->max_intf_count = CSR_ROAM_SESSION_MAX;
@@ -11747,7 +11736,7 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc)
{
hddLog(VOS_TRACE_LEVEL_FATAL,
"%s: wlan_hdd_cfg80211_init return failure", __func__);
- goto err_free_adf_context;
+ goto err_config;
}
}
@@ -11971,7 +11960,7 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc)
if ( VOS_STATUS_SUCCESS != wlan_hdd_ftm_open(pHddCtx) )
{
hddLog(VOS_TRACE_LEVEL_FATAL,"%s: wlan_hdd_ftm_open Failed",__func__);
- goto err_free_adf_context;
+ goto err_config;
}
#if defined(QCA_WIFI_FTM)
if (hdd_ftm_start(pHddCtx))
@@ -12433,10 +12422,6 @@ err_free_ftm_open:
#endif
}
-err_free_adf_context:
- hif_deinit_adf_ctx(hif_sc);
- vos_mem_free(adf_ctx);
-
err_config:
kfree(pHddCtx->cfg_ini);
pHddCtx->cfg_ini= NULL;
@@ -12590,6 +12575,7 @@ static int hdd_driver_init( void)
#define HDD_WLAN_START_WAIT_TIME VOS_WDA_TIMEOUT + 5000
init_completion(&wlan_start_comp);
+
ret_status = hif_register_driver();
if (!ret_status) {
rc = wait_for_completion_timeout(
@@ -12691,7 +12677,6 @@ static void hdd_driver_exit(void)
{
hdd_context_t *pHddCtx = NULL;
int retry = 0;
- adf_os_device_t adf_ctx;
v_CONTEXT_t pVosContext = NULL;
pr_info("%s: unloading driver v%s\n", WLAN_MODULE_NAME, QWLAN_VERSIONSTR);
@@ -12743,13 +12728,6 @@ static void hdd_driver_exit(void)
hif_unregister_driver();
- /*
- * ADF context cannot be freed in hdd_wlan_exit for discrete
- * as it is needed in PCI remove. So free it here.
- */
- adf_ctx = vos_get_context(VOS_MODULE_ID_ADF, pVosContext);
- vos_mem_free(adf_ctx);
-
vos_preClose( &pVosContext );
#ifdef TIMER_MANAGER