diff options
author | Paul Zhang <paulz@codeaurora.org> | 2018-08-01 14:49:37 +0800 |
---|---|---|
committer | Prashanth Swaminathan <prashanthsw@google.com> | 2018-09-07 16:11:10 -0700 |
commit | bf46c5ce71c53852fd5a2d13cfec86da3efa2367 (patch) | |
tree | 8debb3364cd18bc5c272f3a1460234375d2e82a4 | |
parent | e4eff584ecdd17150a930feeb2d99e08d3e21528 (diff) | |
download | qcom-msm-v4.9-bf46c5ce71c53852fd5a2d13cfec86da3efa2367.tar.gz |
qcacld-2.0: Use request manager for fw state
propagation from qcacld-3.0 to qcacld-2.0
We are transitioning to the new request manager framework. Change
wlan_hdd_get_fw_state() and hdd_get_fw_state_cb() to this framework.
CRs-Fixed: 2207624
Bug: 111906763
Test: None
Change-Id: Ibd450d5c50caf6c7c94457e67d1b3a18a30e3955
-rw-r--r-- | techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_main.c | 84 |
1 files changed, 40 insertions, 44 deletions
diff --git a/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_main.c b/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_main.c index 653f70f0f098..d422846fc903 100644 --- a/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_main.c +++ b/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_main.c @@ -3818,47 +3818,33 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind) return; } +struct fw_state { + bool fw_active; +}; + /** * hdd_get_fw_state_cb() - validates the context and notifies the caller - * @callback_context: caller context + * @cookie: cookie from the request contest * * Return: none */ -static void hdd_get_fw_state_cb(void *callback_context) +static void hdd_get_fw_state_cb(void *cookie) { - struct statsContext *context; - hdd_adapter_t *adapter; - - if (NULL == callback_context) { - hddLog(LOGE, FL("Bad pContext [%pK]"), callback_context); - return; - } - - context = callback_context; - adapter = context->pAdapter; - - spin_lock(&hdd_context_lock); + struct hdd_request *request; + struct fw_state *priv; - if ((NULL == adapter) || (FW_STATUS_MAGIC != context->magic)) { - /* the caller presumably timed out so there is - * nothing we can do - */ - spin_unlock(&hdd_context_lock); - hddLog(LOGE, FL("Invalid context, Adapter [%pK] magic [%08x]"), - adapter, context->magic); + request = hdd_request_get(cookie); + if (!request) { + hddLog(LOGE, FL("Obsolete request")); return; } - /* context is valid so caller is still waiting */ - - /* paranoia: invalidate the magic */ - context->magic = 0; + priv = hdd_request_priv(request); - /* notify the caller */ - complete(&context->completion); + priv->fw_active = true; - /* serialization is complete */ - spin_unlock(&hdd_context_lock); + hdd_request_complete(request); + hdd_request_put(request); } /** @@ -3875,38 +3861,48 @@ static void hdd_get_fw_state_cb(void *callback_context) bool wlan_hdd_get_fw_state(hdd_adapter_t *adapter) { hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - struct statsContext context; - eHalStatus hstatus = eHAL_STATUS_SUCCESS; - unsigned long rc; - bool fw_active = true; + eHalStatus hstatus; + int ret; + void *cookie; + struct fw_state *priv; + static const struct hdd_request_params params = { + .priv_size = sizeof(*priv), + .timeout_ms = WLAN_WAIT_TIME_LINK_STATUS, + }; + struct hdd_request *request; + bool fw_active; if (wlan_hdd_validate_context(hdd_ctx) != 0) return false; - init_completion(&context.completion); - context.pAdapter = adapter; - context.magic = FW_STATUS_MAGIC; + request = hdd_request_alloc(¶ms); + if (!request) { + hddLog(LOGE, FL("Request allocation failure")); + return false; + } + + cookie = hdd_request_cookie(request); + hstatus = sme_get_fw_state(WLAN_HDD_GET_HAL_CTX(adapter), hdd_get_fw_state_cb, - &context); - + cookie); if (eHAL_STATUS_SUCCESS != hstatus) { hddLog(LOGE, FL("Unable to retrieve firmware status")); fw_active = false; } else { /* request is sent -- wait for the response */ - rc = wait_for_completion_timeout(&context.completion, - msecs_to_jiffies(WLAN_WAIT_TIME_LINK_STATUS)); - if (!rc) { + ret = hdd_request_wait_for_response(request); + if (ret) { hddLog(LOGE, FL("SME timed out while retrieving firmware status")); fw_active = false; + } else { + priv = hdd_request_priv(request); + fw_active = priv->fw_active; } } - spin_lock(&hdd_context_lock); - context.magic = 0; - spin_unlock(&hdd_context_lock); + hdd_request_put(request); return fw_active; } |