summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorService qcabuildsw <qcabuildsw@localhost>2016-08-25 12:21:48 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-25 12:21:48 -0700
commitc71961083590057dc67569ff9f06fb769f5637f8 (patch)
tree4a19bd75328a65b0c49c1910152dc5589d32bcf7
parent119db31ba776856ff36c6383aef260997310e64c (diff)
parent99286457f60483089157d30e5cd9fdc9fddece12 (diff)
Merge "qcacld-3.0: Check and kickstart the modules state if they are closed" into wlan-cld3.driver.lnx.1.1-dev
-rw-r--r--core/hdd/src/wlan_hdd_p2p.c16
-rw-r--r--core/hdd/src/wlan_hdd_power.c38
2 files changed, 47 insertions, 7 deletions
diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c
index 02ff295d9cc5..16f3953b177d 100644
--- a/core/hdd/src/wlan_hdd_p2p.c
+++ b/core/hdd/src/wlan_hdd_p2p.c
@@ -2048,6 +2048,15 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy,
return ERR_PTR(-ENOSPC);
}
+ /*
+ * Add interface can be requested from the upper layer at any time
+ * check the statemachine for modules state and if they are closed
+ * open the modules.
+ */
+ ret = hdd_wlan_start_modules(pHddCtx, pAdapter, false);
+ if (ret)
+ return ERR_PTR(ret);
+
if (NL80211_IFTYPE_AP == type) {
ret = hdd_start_adapter(pAdapter);
if (ret) {
@@ -2145,6 +2154,13 @@ int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
if (0 != status)
return status;
+ /*
+ * check state machine state and kickstart modules if they are closed.
+ */
+ status = hdd_wlan_start_modules(pHddCtx, pVirtAdapter, false);
+ if (status)
+ return status;
+
wlan_hdd_release_intf_addr(pHddCtx,
pVirtAdapter->macAddressCurrent.bytes);
diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c
index d538ff112010..dde5cbbeba17 100644
--- a/core/hdd/src/wlan_hdd_power.c
+++ b/core/hdd/src/wlan_hdd_power.c
@@ -1919,6 +1919,14 @@ static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
if (0 != status)
return status;
+ mutex_lock(&pHddCtx->iface_change_lock);
+ if (pHddCtx->driver_status != DRIVER_MODULES_ENABLED) {
+ mutex_unlock(&pHddCtx->iface_change_lock);
+ hdd_info("Driver Module not enabled return success");
+ return 0;
+ }
+ mutex_unlock(&pHddCtx->iface_change_lock);
+
if ((DRIVER_POWER_MODE_AUTO == !mode) &&
(true == pHddCtx->hdd_wlan_suspended) &&
(pHddCtx->config->fhostArpOffload) &&
@@ -2081,8 +2089,9 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
int *dbm)
{
- hdd_adapter_t *pAdapter;
hdd_context_t *pHddCtx = (hdd_context_t *) wiphy_priv(wiphy);
+ struct net_device *ndev = wdev->netdev;
+ hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(ndev);
int status;
ENTER();
@@ -2098,17 +2107,32 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
return status;
}
- pAdapter = hdd_get_adapter(pHddCtx, QDF_STA_MODE);
- if (NULL == pAdapter) {
- hdd_err("pAdapter is NULL");
+ if (!adapter) {
+ hdd_err("adapter is NULL");
return -ENOENT;
}
+ /* Validate adapter sessionId */
+ if (adapter->sessionId == HDD_SESSION_ID_INVALID) {
+ hdd_err("Adapter Session Invalid!");
+ return -ENOTSUPP;
+ }
+
+ mutex_lock(&pHddCtx->iface_change_lock);
+ if (pHddCtx->driver_status != DRIVER_MODULES_ENABLED) {
+ mutex_unlock(&pHddCtx->iface_change_lock);
+ hdd_info("Driver Module not enabled return success");
+ /* Send cached data to upperlayer*/
+ *dbm = adapter->hdd_stats.ClassA_stat.max_pwr;
+ return 0;
+ }
+ mutex_unlock(&pHddCtx->iface_change_lock);
+
MTRACE(qdf_trace(QDF_MODULE_ID_HDD,
TRACE_CODE_HDD_CFG80211_GET_TXPOWER,
- pAdapter->sessionId, pAdapter->device_mode));
- wlan_hdd_get_class_astats(pAdapter);
- *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr;
+ adapter->sessionId, adapter->device_mode));
+ wlan_hdd_get_class_astats(adapter);
+ *dbm = adapter->hdd_stats.ClassA_stat.max_pwr;
EXIT();
return 0;