Prechádzať zdrojové kódy

qcacld-3.0: Refine wlan_hdd_get_adapter_by_vdev_id_from_objmgr

Refine API to get adapter from vdev directly.

Remove parameter hdd_ctx of wlan_hdd_get_adapter_by_vdev_id_from_objmgr.
It is good enough to get adapter from input parameter vdev.
Move output parameter adapter to return value.

Change-Id: Ide6ac7466cee0f1e7fea9b31d325bd432548ff55
CRs-Fixed: 3037265
Bing Sun 3 rokov pred
rodič
commit
7ff37bd587
2 zmenil súbory, kde vykonal 12 pridanie a 24 odobranie
  1. 4 9
      core/hdd/inc/wlan_hdd_main.h
  2. 8 15
      core/hdd/src/wlan_hdd_main.c

+ 4 - 9
core/hdd/inc/wlan_hdd_main.h

@@ -2611,18 +2611,13 @@ void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter,
 							next_adapter, dbgid))
 
 /**
- * wlan_hdd_get_adapter_by_vdev_id_from_objmgr() - Fetch adapter from objmgr
- * using vdev_id.
- * @hdd_ctx: the global HDD context
- * @adapter: an hdd_adapter double pointer to store the address of the adapter
+ * wlan_hdd_get_adapter_from_objmgr() - Fetch adapter from objmgr
  * @vdev: the vdev whose corresponding adapter has to be fetched
  *
- * Return: QDF_STATUS
+ * Return: the address of the adapter
  */
-QDF_STATUS
-wlan_hdd_get_adapter_by_vdev_id_from_objmgr(struct hdd_context *hdd_ctx,
-					    struct hdd_adapter **adapter,
-					    struct wlan_objmgr_vdev *vdev);
+struct hdd_adapter *
+wlan_hdd_get_adapter_from_objmgr(struct wlan_objmgr_vdev *vdev);
 
 struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx,
 				     uint8_t session_type,

+ 8 - 15
core/hdd/src/wlan_hdd_main.c

@@ -11415,23 +11415,18 @@ static inline void hdd_lte_coex_restart_sap(struct hdd_adapter *adapter,
 }
 #endif /* defined(FEATURE_WLAN_CH_AVOID) */
 
-QDF_STATUS
-wlan_hdd_get_adapter_by_vdev_id_from_objmgr(struct hdd_context *hdd_ctx,
-					    struct hdd_adapter **adapter,
-					    struct wlan_objmgr_vdev *vdev)
+struct hdd_adapter *
+wlan_hdd_get_adapter_from_objmgr(struct wlan_objmgr_vdev *vdev)
 {
-	*adapter = NULL;
-	if (!hdd_ctx)
-		return QDF_STATUS_E_INVAL;
-
 	if (!vdev) {
 		hdd_err("null vdev object");
-		return QDF_STATUS_E_INVAL;
+		return NULL;
 	}
 
-	*adapter = vdev->vdev_nif.osdev->legacy_osif_priv;
+	if (vdev->vdev_nif.osdev)
+		return vdev->vdev_nif.osdev->legacy_osif_priv;
 
-	return QDF_STATUS_SUCCESS;
+	return NULL;
 }
 
 /**
@@ -11453,7 +11448,6 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind)
 	uint8_t vdev_id[WLAN_MAX_VDEVS];
 	struct ieee80211_mgmt *mgmt =
 		(struct ieee80211_mgmt *)frame_ind->frameBuf;
-	QDF_STATUS status;
 	struct wlan_objmgr_vdev *vdev;
 	wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_INDICATE_MGMT_FRAME;
 
@@ -11494,10 +11488,9 @@ void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind)
 			if (!vdev)
 				continue;
 
-			status = wlan_hdd_get_adapter_by_vdev_id_from_objmgr(
-						hdd_ctx, &adapter, vdev);
+			adapter = wlan_hdd_get_adapter_from_objmgr(vdev);
 
-			if (QDF_IS_STATUS_ERROR(status) || !adapter) {
+			if (!adapter) {
 				wlan_objmgr_vdev_release_ref(vdev,
 							     WLAN_OSIF_ID);
 				continue;