From 3d7c0e6d331daaf99888f7388c09d9033ae65eed Mon Sep 17 00:00:00 2001 From: Paul Zhang Date: Sat, 29 Jun 2019 08:57:47 +0800 Subject: [PATCH] qcacld-3.0: refine interface wlan_hdd_cfg80211_get_txpower Currently wlan_hdd_cfg80211_get_txpower is limited for STA device. This causes issue when SAP device wants to get the tx power. Change-Id: Iadf34e6c74ba013247d925bcd4f05e1aa1a971c9 CRs-Fixed: 2481680 --- core/hdd/src/wlan_hdd_power.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 54a95ae40e90..48cddd1ea0e0 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2147,7 +2147,6 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, struct net_device *ndev = wdev->netdev; struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev); int status; - struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); hdd_enter_dev(ndev); @@ -2167,9 +2166,21 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, if (status) return status; - if (sta_ctx->hdd_reassoc_scenario) { - hdd_debug("Roaming is in progress, rej this req"); - return -EINVAL; + if (adapter->device_mode == QDF_STA_MODE || + adapter->device_mode == QDF_P2P_CLIENT_MODE) { + struct hdd_station_ctx *sta_ctx; + + sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); + if (sta_ctx->hdd_reassoc_scenario) { + hdd_debug("Roaming is in progress, rej this req"); + return -EINVAL; + } + + if (sta_ctx->conn_info.conn_state != + eConnectionState_Associated) { + hdd_debug("Not associated"); + return 0; + } } if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) { @@ -2179,11 +2190,6 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, return 0; } - if (sta_ctx->conn_info.conn_state != eConnectionState_Associated) { - hdd_debug("Not associated"); - return 0; - } - qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_GET_TXPOWER, adapter->vdev_id, adapter->device_mode);