diff options
| author | Komal Seelam <kseelam@qti.qualcomm.com> | 2016-04-06 18:41:05 +0530 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2016-04-11 12:43:55 +0530 |
| commit | ad1144ded9453a50610afa72be6cd89cd82d8e1f (patch) | |
| tree | b3481d05d982cd065ad22f607f86520022bf88b3 | |
| parent | e8e15c33b983fe7236b5f59c1bea749a5971a0be (diff) | |
qcacld-2.0: Set wlan_start_comp for failure cases as well
If Driver load fails in hdd_wlan_startup, hdd_wlan_init waits
till the completion event is set. This is not optimal. Hence
set the completion event even for failure and set the global status
to false to handle error cases.
Change-Id: Icd861fe506b9687f431be1eb43a29edbb20002a7
CRs-Fixed: 1000344
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_main.c | 83 |
1 files changed, 60 insertions, 23 deletions
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index c0064c196e75..a6249e15d7ed 100644 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -305,7 +305,17 @@ static int hdd_ParseIBSSTXFailEventParams(tANI_U8 *pValue, void wlan_hdd_restart_timer_cb(v_PVOID_t usrDataForCallback); -struct completion wlan_start_comp; +/** + * struct init_comp - Driver loading status + * @wlan_start_comp: Completion event + * @status: Success/Failure + */ +struct init_comp { + struct completion wlan_start_comp; + int status; +}; +static struct init_comp wlan_comp; + #ifdef QCA_WIFI_FTM extern int hdd_ftm_start(hdd_context_t *pHddCtx); extern int hdd_ftm_stop(hdd_context_t *pHddCtx); @@ -14602,7 +14612,8 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc) memdump_init(); hdd_driver_memdump_init(); hddLog(LOGE, FL("FTM driver loaded")); - complete(&wlan_start_comp); + wlan_comp.status = 0; + complete(&wlan_comp.wlan_start_comp); return VOS_STATUS_SUCCESS; } @@ -15063,7 +15074,8 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc) if (eHAL_STATUS_SUCCESS != hal_status) hddLog(LOGE, FL("Failed to disable Chan Avoidance Indcation")); } - complete(&wlan_start_comp); + wlan_comp.status = 0; + complete(&wlan_comp.wlan_start_comp); goto success; err_nl_srv: @@ -15176,6 +15188,8 @@ err_free_hdd_context: } hdd_set_ssr_required (VOS_FALSE); + wlan_comp.status = -EAGAIN; + complete(&wlan_comp.wlan_start_comp); return -EIO; success: @@ -15183,6 +15197,48 @@ success: return 0; } +/* accommodate the request firmware bin time out 2 min */ +#define REQUEST_FWR_TIMEOUT 120000 +#define HDD_WLAN_START_WAIT_TIME (VOS_WDA_TIMEOUT + 5000 + REQUEST_FWR_TIMEOUT) +/** + * hdd_hif_register_driver() - API for HDD to register with HIF + * + * API for HDD to register with HIF layer + * + * Return: success/failure + */ +int hdd_hif_register_driver(void) +{ + int ret; + unsigned long rc, timeout; + + init_completion(&wlan_comp.wlan_start_comp); + wlan_comp.status = 0; + + ret = hif_register_driver(); + + if (ret) { + hddLog(LOGE, FL("HIF registration failed")); + return ret; + } + + timeout = msecs_to_jiffies(HDD_WLAN_START_WAIT_TIME); + + rc = wait_for_completion_timeout(&wlan_comp.wlan_start_comp, timeout); + + if (!rc) { + hddLog(LOGE, FL("hif registration timedout")); + return -EAGAIN; + } + + if (wlan_comp.status) + hddLog(LOGE, + FL("hdd_wlan_startup failed status:%d jiffies_left:%lu"), + wlan_comp.status, rc); + + return wlan_comp.status; +} + /**--------------------------------------------------------------------------- \brief hdd_driver_init() - Core Driver Init Function @@ -15200,7 +15256,6 @@ static int hdd_driver_init( void) VOS_STATUS status; v_CONTEXT_t pVosContext = NULL; int ret_status = 0; - unsigned long rc; u_int64_t start; start = adf_get_boottime(); @@ -15287,25 +15342,7 @@ static int hdd_driver_init( void) hdd_set_conparam((v_UINT_t)con_mode); #endif -/* accommodate the request firmware bin time out 2 min */ -#define REQUEST_FWR_TIMEOUT 120000 -#define HDD_WLAN_START_WAIT_TIME (VOS_WDA_TIMEOUT + 5000 + REQUEST_FWR_TIMEOUT) - - init_completion(&wlan_start_comp); - - ret_status = hif_register_driver(); - if (!ret_status) { - rc = wait_for_completion_timeout( - &wlan_start_comp, - msecs_to_jiffies(HDD_WLAN_START_WAIT_TIME)); - if (!rc) { - hddLog(VOS_TRACE_LEVEL_FATAL, - "%s: timed-out waiting for hif_register_driver", __func__); - ret_status = -1; - } else - ret_status = 0; - } - + ret_status = hdd_hif_register_driver(); vos_remove_pm_qos(); hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT); |
