summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCNSS_WLAN Service <cnssbldsw@qualcomm.com>2018-04-08 23:19:42 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-04-08 23:19:42 -0700
commit199255c1c4fa60e2d18b5c33a97aa8bc0852815f (patch)
tree573c8de3442d7a4474b91a7ebf0c8e4e286bebcc
parent2201be54bab98288aafecdf4676271ab04baa8cf (diff)
parent7e5c174fafc73425824c0ca9e13cb5a4813cdb23 (diff)
Merge "qcacld-2.0: Use request manager for fw state" into wlan-cld2.driver.lnx.1.0
-rw-r--r--CORE/HDD/src/wlan_hdd_main.c84
1 files changed, 40 insertions, 44 deletions
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 4bfa59d494c5..190a91c0c355 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -4104,47 +4104,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);
}
/**
@@ -4161,38 +4147,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(&params);
+ 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;
}