diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2018-07-09 05:08:40 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-07-09 05:08:40 -0700 |
| commit | 064f457bc0c10e78365a4af68e2debef30b13875 (patch) | |
| tree | a0ca1123401c0c2aa19083ef3ca2190150974c6a | |
| parent | c6b9f11a0a7dbacb9fad659d7ebe7cb64f25d1c4 (diff) | |
| parent | f8d12a036de4d7d86732529c84c5a2bae809fb90 (diff) | |
Merge "qcacld-2.0: Use request manager for thermal get temperature"
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_wext.h | 4 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 54 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_wext.c | 4 |
3 files changed, 42 insertions, 20 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_wext.h b/CORE/HDD/inc/wlan_hdd_wext.h index ceccc79b1c63..8b52163b66c7 100644 --- a/CORE/HDD/inc/wlan_hdd_wext.h +++ b/CORE/HDD/inc/wlan_hdd_wext.h @@ -346,6 +346,10 @@ typedef struct ccp_freq_chan_map_s{ v_U32_t chan; }hdd_freq_chan_map_t; +struct temperature_info { + int temperature; +}; + #define wlan_hdd_get_wps_ie_ptr(ie, ie_len) \ wlan_hdd_get_vendor_oui_ie_ptr(WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE, ie, ie_len) diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index 6af4621d1841..4b6333ab2c48 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -8402,12 +8402,19 @@ wlan_hdd_thermal_cmd_get_temperature(struct wiphy *wiphy, struct wireless_dev *wdev) { eHalStatus status; - struct statsContext temp_context; + int ret; unsigned long rc; struct sk_buff *nl_resp = 0; hdd_context_t *hdd_ctx = wiphy_priv(wiphy); struct net_device *dev = wdev->netdev; hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + void *cookie; + struct hdd_request *request; + struct temperature_info *priv = NULL; + static const struct hdd_request_params params = { + .priv_size = sizeof(*priv), + .timeout_ms = WLAN_WAIT_TIME_STATS, + }; if (VOS_FTM_MODE == hdd_get_conparam()) { hddLog(LOGE, FL("Command not allowed in FTM mode")); @@ -8417,28 +8424,43 @@ wlan_hdd_thermal_cmd_get_temperature(struct wiphy *wiphy, if (wlan_hdd_validate_context(hdd_ctx)) return -EINVAL; - /* prepare callback context and magic pattern */ - init_completion(&temp_context.completion); - temp_context.pAdapter = adapter; - temp_context.magic = TEMP_CONTEXT_MAGIC; + if (NULL == adapter) + { + hddLog(VOS_TRACE_LEVEL_ERROR, + FL("adapter is NULL")); + return VOS_STATUS_E_FAULT; + } + + request = hdd_request_alloc(¶ms); + if (!request) { + hddLog(VOS_TRACE_LEVEL_ERROR, + "%s: Request allocation failure", __func__); + return VOS_STATUS_E_NOMEM; + } + cookie = hdd_request_cookie(request); status = sme_GetTemperature(WLAN_HDD_GET_HAL_CTX(adapter), - &temp_context, hdd_GetTemperatureCB); + cookie, hdd_GetTemperatureCB); if (eHAL_STATUS_SUCCESS != status) { hddLog(VOS_TRACE_LEVEL_ERROR, FL("Unable to get temperature")); } else { - rc = wait_for_completion_timeout(&temp_context.completion, - msecs_to_jiffies(1000)); - if (!rc) { - hddLog(VOS_TRACE_LEVEL_ERROR, - FL("SME timed out while getting temperature")); - return -EBUSY; - } + /* request was sent -- wait for the response */ + ret = hdd_request_wait_for_response(request); + if (ret) { + hddLog(VOS_TRACE_LEVEL_WARN, + FL("timeout when get temperature")); + /* we'll returned a cached value below */ + } else { + /* update the adapter with the fresh results */ + priv = hdd_request_priv(request); + /* ignore it if this was 0 */ + if (priv->temperature != 0) + adapter->temperature = + priv->temperature; + } } - spin_lock(&hdd_context_lock); - temp_context.magic = 0; - spin_unlock(&hdd_context_lock); + hdd_request_put(request); nl_resp = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 4 + NLMSG_HDRLEN); if (!nl_resp) { diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c index 590bdddbe8de..7bdadcb695cf 100644 --- a/CORE/HDD/src/wlan_hdd_wext.c +++ b/CORE/HDD/src/wlan_hdd_wext.c @@ -5572,10 +5572,6 @@ int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal, return 0; } -struct temperature_info { - int temperature; -}; - void hdd_GetTemperatureCB(int temperature, void *cookie) { struct hdd_request *request; |
