瀏覽代碼

qcacld-3.0: Use get/put to refer vdev [1/4]

Any direct reference to adapter->vdev outside the initial
assignment should use get/put to properly refer the vdev.
        core/hdd/src/wlan_hdd_ioctl.c
        core/hdd/src/wlan_hdd_station_info.c
        os_if/interop_issues_ap/src/wlan_cfg80211_interop_issues_ap.c

Change-Id: I897ee8ac2a4816b91ed48e2c32e97540430c5520
CRs-Fixed: 2714025
Paul Zhang 4 年之前
父節點
當前提交
baac594a3f

+ 23 - 5
core/hdd/src/wlan_hdd_ioctl.c

@@ -42,6 +42,7 @@
 #include <sme_api.h>
 #include <sir_api.h>
 #endif
+#include "wlan_hdd_object_manager.h"
 #include "hif.h"
 #include "wlan_scan_ucfg_api.h"
 #include "wlan_reg_ucfg_api.h"
@@ -5804,6 +5805,7 @@ hdd_set_dynamic_antenna_mode(struct hdd_adapter *adapter,
 	QDF_STATUS status;
 	mac_handle_t mac_handle;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	struct wlan_objmgr_vdev *vdev;
 
 	mac_handle = hdd_ctx->mac_handle;
 	if (!mac_handle) {
@@ -5817,15 +5819,24 @@ hdd_set_dynamic_antenna_mode(struct hdd_adapter *adapter,
 		return -EINVAL;
 	}
 
+	vdev = hdd_objmgr_get_vdev(adapter);
+	if (!vdev) {
+		hdd_err("vdev is NULL");
+		return -EINVAL;
+	}
+
 	qdf_mem_zero(&user_cfg, sizeof(user_cfg));
 	for (band = NSS_CHAINS_BAND_2GHZ; band < NSS_CHAINS_BAND_MAX; band++) {
 		status = hdd_populate_vdev_chains(&user_cfg,
 						  num_rx_chains,
-						  num_tx_chains, band,
-						  adapter->vdev);
-		if (QDF_IS_STATUS_ERROR(status))
+						  num_tx_chains, band, vdev);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			hdd_objmgr_put_vdev(vdev);
 			return -EINVAL;
+		}
 	}
+	hdd_objmgr_put_vdev(vdev);
+
 	status = sme_nss_chains_update(mac_handle,
 				       &user_cfg,
 				       adapter->vdev_id);
@@ -6011,12 +6022,19 @@ static inline int drv_cmd_get_antenna_mode(struct hdd_adapter *adapter,
 	uint32_t antenna_mode = 0;
 	char extra[32];
 	uint8_t len = 0;
+	struct wlan_objmgr_vdev *vdev;
+
+	vdev = hdd_objmgr_get_vdev(adapter);
+	if (!vdev) {
+		hdd_err("vdev is NULL");
+		return -EINVAL;
+	}
 
 	antenna_mode = hdd_ctx->current_antenna_mode;
 	/* Overwrite this antenna mode if dynamic vdev chains are supported */
 	hdd_get_dynamic_antenna_mode(&antenna_mode,
-				     hdd_ctx->dynamic_nss_chains_support,
-				     adapter->vdev);
+				     hdd_ctx->dynamic_nss_chains_support, vdev);
+	hdd_objmgr_put_vdev(vdev);
 	len = scnprintf(extra, sizeof(extra), "%s %d", command,
 			antenna_mode);
 	len = QDF_MIN(priv_data->total_len, len + 1);

+ 9 - 1
core/hdd/src/wlan_hdd_station_info.c

@@ -35,6 +35,7 @@
 #include <wlan_hdd_station_info.h>
 #include "wlan_mlme_ucfg_api.h"
 #include "wlan_hdd_sta_info.h"
+#include "wlan_hdd_object_manager.h"
 
 /*
  * define short names for the global vendor params
@@ -133,8 +134,15 @@ static int hdd_get_sta_congestion(struct hdd_adapter *adapter,
 {
 	QDF_STATUS status;
 	struct cca_stats cca_stats;
+	struct wlan_objmgr_vdev *vdev;
 
-	status = ucfg_mc_cp_stats_cca_stats_get(adapter->vdev, &cca_stats);
+	vdev = hdd_objmgr_get_vdev(adapter);
+	if (!vdev) {
+		hdd_err("vdev is NULL");
+		return -EINVAL;
+	}
+	status = ucfg_mc_cp_stats_cca_stats_get(vdev, &cca_stats);
+	hdd_objmgr_put_vdev(vdev);
 	if (QDF_IS_STATUS_ERROR(status))
 		return -EINVAL;
 

+ 6 - 2
os_if/interop_issues_ap/src/wlan_cfg80211_interop_issues_ap.c

@@ -33,6 +33,7 @@
 #include <wlan_utility.h>
 #include "wlan_hdd_main.h"
 #include "cfg_ucfg_api.h"
+#include "wlan_hdd_object_manager.h"
 
 const struct nla_policy
 interop_issues_ap_policy[QCA_WLAN_VENDOR_ATTR_INTEROP_ISSUES_AP_MAX + 1] = {
@@ -178,13 +179,16 @@ __wlan_cfg80211_set_interop_issues_ap_config(struct wiphy *wiphy,
 	uint32_t count = 0;
 	struct wlan_interop_issues_ap_info interop_issues_ap = {0};
 	struct wlan_objmgr_psoc *psoc;
+	struct wlan_objmgr_vdev *vdev;
 
-	if (!adapter->vdev) {
+	vdev = hdd_objmgr_get_vdev(adapter);
+	if (!vdev) {
 		osif_err("Invalid vdev");
 		return -EINVAL;
 	}
 
-	psoc = wlan_vdev_get_psoc(adapter->vdev);
+	psoc = wlan_vdev_get_psoc(vdev);
+	hdd_objmgr_put_vdev(vdev);
 	if (!psoc) {
 		osif_err("Invalid psoc");
 		return -EINVAL;