Browse Source

qcacld-3.0: Remove hdd_adapter_list_node_t

Linux convention is to embed a list node in a structure that is meant to
be a member of a list. However, hdd_adapter_list_node_t is created to
contain both the list node and the list item itself. Remove
hdd_adapter_list_node_t and embed the list node directly into
hdd_adapter instead.

Change-Id: I62888a0212d88aa212fee34b886e3d8a4875e0c7
CRs-Fixed: 2159309
Dustin Brown 7 years ago
parent
commit
920397d930

+ 20 - 12
core/hdd/inc/wlan_hdd_main.h

@@ -989,6 +989,9 @@ struct hdd_adapter {
 	 */
 	uint32_t magic;
 
+	/* list node for membership in the adapter list */
+	qdf_list_node_t node;
+
 	struct hdd_context *hdd_ctx;
 	struct wlan_objmgr_vdev *hdd_vdev;
 
@@ -1245,11 +1248,6 @@ struct hdd_adapter {
 #define HDD_DEFAULT_MCC_P2P_QUOTA    70
 #define HDD_RESET_MCC_P2P_QUOTA      50
 
-typedef struct hdd_adapter_list_node {
-	qdf_list_node_t node;   /* MUST be first element */
-	struct hdd_adapter *adapter;
-} hdd_adapter_list_node_t;
-
 /*
  * struct hdd_priv_data - driver ioctl private data payload
  * @buf: pointer to command buffer (may be in userspace)
@@ -1808,23 +1806,33 @@ int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter,
 const char *hdd_device_mode_to_string(uint8_t device_mode);
 
 QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx,
-				 hdd_adapter_list_node_t **ppAdapterNode);
+				 struct hdd_adapter **out_adapter);
 
 QDF_STATUS hdd_get_next_adapter(struct hdd_context *hdd_ctx,
-				hdd_adapter_list_node_t *pAdapterNode,
-				hdd_adapter_list_node_t **pNextAdapterNode);
+				struct hdd_adapter *current_adapter,
+				struct hdd_adapter **out_adapter);
 
 QDF_STATUS hdd_remove_adapter(struct hdd_context *hdd_ctx,
-			      hdd_adapter_list_node_t *pAdapterNode);
+			      struct hdd_adapter *adapter);
 
 QDF_STATUS hdd_remove_front_adapter(struct hdd_context *hdd_ctx,
-				    hdd_adapter_list_node_t **ppAdapterNode);
+				    struct hdd_adapter **out_adapter);
 
 QDF_STATUS hdd_add_adapter_back(struct hdd_context *hdd_ctx,
-				hdd_adapter_list_node_t *pAdapterNode);
+				struct hdd_adapter *adapter);
 
 QDF_STATUS hdd_add_adapter_front(struct hdd_context *hdd_ctx,
-				 hdd_adapter_list_node_t *pAdapterNode);
+				 struct hdd_adapter *adapter);
+
+/**
+ * hdd_for_each_adapter - adapter iterator macro
+ * @hdd_ctx: the global HDD context
+ * @adapter: an hdd_adapter pointer to use as a cursor
+ */
+#define hdd_for_each_adapter(hdd_ctx, adapter) \
+	for (hdd_get_front_adapter(hdd_ctx, &adapter); \
+	     adapter; \
+	     hdd_get_next_adapter(hdd_ctx, adapter, &adapter))
 
 struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx,
 				     uint8_t session_type,

+ 5 - 27
core/hdd/src/wlan_hdd_cfg80211.c

@@ -4131,17 +4131,10 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx,
 				enum QDF_OPMODE device_mode)
 {
 	struct hdd_adapter *adapter;
-	hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
 	struct hdd_ap_ctx *ap_ctx;
 	struct hdd_station_ctx *sta_ctx;
-	QDF_STATUS qdf_status;
-
-	qdf_status = hdd_get_front_adapter(hdd_ctx,
-					   &adapter_node);
-	while ((NULL != adapter_node) &&
-	       (QDF_STATUS_SUCCESS == qdf_status)) {
-		adapter = adapter_node->adapter;
 
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		if ((device_mode == adapter->device_mode) &&
 		    (device_mode == QDF_SAP_MODE)) {
 			ap_ctx =
@@ -4179,11 +4172,6 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx,
 				return true;
 			}
 		}
-
-		qdf_status = hdd_get_next_adapter(hdd_ctx,
-						  adapter_node,
-						  &next);
-		adapter_node = next;
 	}
 
 	return false;
@@ -9857,22 +9845,14 @@ static enum sta_roam_policy_dfs_mode wlan_hdd_get_sta_roam_dfs_mode(
  */
 uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx)
 {
-	hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
-	QDF_STATUS status;
 	struct hdd_adapter *adapter;
 	uint8_t  operating_channel = 0;
 	uint8_t sap_operating_band = 0;
 
-	status = hdd_get_front_adapter(hdd_ctx, &adapter_node);
-	while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) {
-		adapter = adapter_node->adapter;
-
-		if (!(adapter && (QDF_SAP_MODE == adapter->device_mode))) {
-			status = hdd_get_next_adapter(hdd_ctx, adapter_node,
-					&next);
-			adapter_node = next;
+	hdd_for_each_adapter(hdd_ctx, adapter) {
+		if (adapter->device_mode != QDF_SAP_MODE)
 			continue;
-		}
+
 		operating_channel = adapter->session.ap.operating_channel;
 		if (IS_24G_CH(operating_channel))
 			sap_operating_band = BAND_2G;
@@ -9880,10 +9860,8 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx)
 			sap_operating_band = BAND_5G;
 		else
 			sap_operating_band = BAND_ALL;
-		status = hdd_get_next_adapter(hdd_ctx, adapter_node,
-				&next);
-		adapter_node = next;
 	}
+
 	return sap_operating_band;
 }
 

+ 1 - 10
core/hdd/src/wlan_hdd_ioctl.c

@@ -5671,13 +5671,10 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter,
 	int ret = 0;
 	int status;
 	int txPower;
-	QDF_STATUS qdf_status;
 	QDF_STATUS smeStatus;
 	uint8_t *value = command;
 	struct qdf_mac_addr bssid = QDF_MAC_ADDR_BROADCAST_INITIALIZER;
 	struct qdf_mac_addr selfMac = QDF_MAC_ADDR_BROADCAST_INITIALIZER;
-	hdd_adapter_list_node_t *pAdapterNode = NULL;
-	hdd_adapter_list_node_t *pNext = NULL;
 
 	status = hdd_parse_setmaxtxpower_command(value, &txPower);
 	if (status) {
@@ -5686,10 +5683,7 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter,
 		goto exit;
 	}
 
-	qdf_status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode);
-	while (NULL != pAdapterNode
-	       && QDF_STATUS_SUCCESS == qdf_status) {
-		adapter = pAdapterNode->adapter;
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		/* Assign correct self MAC address */
 		qdf_copy_macaddr(&bssid,
 				 &adapter->mac_addr);
@@ -5710,9 +5704,6 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter,
 			goto exit;
 		}
 		hdd_debug("Set max tx power success");
-		qdf_status = hdd_get_next_adapter(hdd_ctx, pAdapterNode,
-						  &pNext);
-		pAdapterNode = pNext;
 	}
 
 exit:

+ 5 - 24
core/hdd/src/wlan_hdd_ipa.c

@@ -1350,8 +1350,6 @@ void hdd_ipa_dump_info(struct hdd_context *hdd_ctx)
  */
 void hdd_ipa_set_tx_flow_info(void)
 {
-	hdd_adapter_list_node_t *adapterNode = NULL, *pNext = NULL;
-	QDF_STATUS status;
 	struct hdd_adapter *adapter;
 	struct hdd_station_ctx *sta_ctx;
 	struct hdd_ap_ctx *hdd_ap_ctx;
@@ -1388,9 +1386,8 @@ void hdd_ipa_set_tx_flow_info(void)
 	}
 
 	psoc = hdd_ctx->hdd_psoc;
-	status = hdd_get_front_adapter(hdd_ctx, &adapterNode);
-	while (NULL != adapterNode && QDF_STATUS_SUCCESS == status) {
-		adapter = adapterNode->adapter;
+
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		switch (adapter->device_mode) {
 		case QDF_STA_MODE:
 			sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
@@ -1630,9 +1627,8 @@ void hdd_ipa_set_tx_flow_info(void)
 		}
 		targetChannel = 0;
 #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
-		status = hdd_get_next_adapter(hdd_ctx, adapterNode, &pNext);
-		adapterNode = pNext;
 	}
+
 	hdd_ctx->mcc_mode = policy_mgr_current_concurrency_is_mcc(psoc);
 }
 
@@ -3424,24 +3420,16 @@ static int hdd_ipa_uc_disconnect_sta(struct hdd_adapter *adapter)
  */
 static int hdd_ipa_uc_disconnect(struct hdd_context *hdd_ctx)
 {
-	hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
-	QDF_STATUS status;
 	struct hdd_adapter *adapter;
 	int ret = 0;
 
-	status =  hdd_get_front_adapter(hdd_ctx, &adapter_node);
-	while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) {
-		adapter = adapter_node->adapter;
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		if (adapter->device_mode == QDF_SAP_MODE) {
 			hdd_ipa_uc_disconnect_client(adapter);
 			hdd_ipa_uc_disconnect_ap(adapter);
 		} else if (adapter->device_mode == QDF_STA_MODE) {
 			hdd_ipa_uc_disconnect_sta(adapter);
 		}
-
-		status = hdd_get_next_adapter(
-				hdd_ctx, adapter_node, &next);
-		adapter_node = next;
 	}
 
 	return ret;
@@ -5206,8 +5194,6 @@ end:
 static int __hdd_ipa_send_mcc_scc_msg(struct hdd_context *hdd_ctx,
 				      bool mcc_mode)
 {
-	hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
-	QDF_STATUS status;
 	struct hdd_adapter *adapter;
 	qdf_ipa_msg_meta_t meta;
 	qdf_ipa_wlan_msg_t *msg;
@@ -5222,18 +5208,13 @@ static int __hdd_ipa_send_mcc_scc_msg(struct hdd_context *hdd_ctx,
 
 	if (!hdd_ctx->mcc_mode) {
 		/* Flush TxRx queue for each adapter before switch to SCC */
-		status =  hdd_get_front_adapter(hdd_ctx, &adapter_node);
-		while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) {
-			adapter = adapter_node->adapter;
+		hdd_for_each_adapter(hdd_ctx, adapter) {
 			if (adapter->device_mode == QDF_STA_MODE ||
 			    adapter->device_mode == QDF_SAP_MODE) {
 				hdd_debug("MCC->SCC: Flush TxRx queue(d_mode=%d)",
 					 adapter->device_mode);
 				hdd_deinit_tx_rx(adapter);
 			}
-			status = hdd_get_next_adapter(
-					hdd_ctx, adapter_node, &next);
-			adapter_node = next;
 		}
 	}
 

+ 6 - 15
core/hdd/src/wlan_hdd_lpass.c

@@ -283,29 +283,20 @@ static void wlan_hdd_send_version_pkg(uint32_t fw_version,
 static void wlan_hdd_send_all_scan_intf_info(struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *adapter = NULL;
-	hdd_adapter_list_node_t *node = NULL, *next = NULL;
 	bool scan_intf_found = false;
-	QDF_STATUS status;
 
 	if (!hdd_ctx) {
 		hdd_err("NULL pointer for hdd_ctx");
 		return;
 	}
 
-	status = hdd_get_front_adapter(hdd_ctx, &node);
-	while (NULL != node && QDF_STATUS_SUCCESS == status) {
-		adapter = node->adapter;
-		if (adapter) {
-			if (adapter->device_mode == QDF_STA_MODE
-			    || adapter->device_mode == QDF_P2P_CLIENT_MODE
-			    || adapter->device_mode ==
-			    QDF_P2P_DEVICE_MODE) {
-				scan_intf_found = true;
-				wlan_hdd_send_status_pkg(adapter, NULL, 1, 0);
-			}
+	hdd_for_each_adapter(hdd_ctx, adapter) {
+		if (adapter->device_mode == QDF_STA_MODE ||
+		    adapter->device_mode == QDF_P2P_CLIENT_MODE ||
+		    adapter->device_mode == QDF_P2P_DEVICE_MODE) {
+			scan_intf_found = true;
+			wlan_hdd_send_status_pkg(adapter, NULL, 1, 0);
 		}
-		status = hdd_get_next_adapter(hdd_ctx, node, &next);
-		node = next;
 	}
 
 	if (!scan_intf_found)

File diff suppressed because it is too large
+ 150 - 357
core/hdd/src/wlan_hdd_main.c


+ 1 - 11
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -168,15 +168,8 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *adapter;
 	struct hdd_station_ctx *sta_ctx;
-	QDF_STATUS status;
-	hdd_adapter_list_node_t *curr = NULL, *next = NULL;
-
-	status = hdd_get_front_adapter(hdd_ctx, &curr);
-	while (QDF_STATUS_SUCCESS == status) {
-		adapter = curr->adapter;
-		if (!adapter)
-			goto next_adapter;
 
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		switch (adapter->device_mode) {
 		case QDF_P2P_GO_MODE:
 		case QDF_SAP_MODE:
@@ -194,9 +187,6 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
 		default:
 			break;
 		}
-next_adapter:
-		status = hdd_get_next_adapter(hdd_ctx, curr, &next);
-		curr = next;
 	}
 
 	return true;

+ 10 - 19
core/hdd/src/wlan_hdd_oemdata.c

@@ -183,10 +183,7 @@ static void send_oem_reg_rsp_nlink_msg(void)
 	uint8_t *numInterfaces;
 	uint8_t *deviceMode;
 	uint8_t *vdevId;
-	hdd_adapter_list_node_t *pAdapterNode = NULL;
-	hdd_adapter_list_node_t *pNext = NULL;
-	struct hdd_adapter *adapter = NULL;
-	QDF_STATUS status = 0;
+	struct hdd_adapter *adapter;
 
 	/* OEM msg is always to a specific process & cannot be a broadcast */
 	if (p_hdd_ctx->oem_pid == 0) {
@@ -217,21 +214,15 @@ static void send_oem_reg_rsp_nlink_msg(void)
 	*numInterfaces = 0;
 
 	/* Iterate through each adapter and fill device mode and vdev id */
-	status = hdd_get_front_adapter(p_hdd_ctx, &pAdapterNode);
-	while ((QDF_STATUS_SUCCESS == status) && pAdapterNode) {
-		adapter = pAdapterNode->adapter;
-		if (adapter) {
-			deviceMode = buf++;
-			vdevId = buf++;
-			*deviceMode = adapter->device_mode;
-			*vdevId = adapter->session_id;
-			(*numInterfaces)++;
-			hdd_debug("numInterfaces: %d, deviceMode: %d, vdevId: %d",
-				   *numInterfaces, *deviceMode,
-				   *vdevId);
-		}
-		status = hdd_get_next_adapter(p_hdd_ctx, pAdapterNode, &pNext);
-		pAdapterNode = pNext;
+	hdd_for_each_adapter(p_hdd_ctx, adapter) {
+		deviceMode = buf++;
+		vdevId = buf++;
+		*deviceMode = adapter->device_mode;
+		*vdevId = adapter->session_id;
+		(*numInterfaces)++;
+		hdd_debug("numInterfaces: %d, deviceMode: %d, vdevId: %d",
+			  *numInterfaces, *deviceMode,
+			  *vdevId);
 	}
 
 	aniHdr->length =

+ 3 - 8
core/hdd/src/wlan_hdd_p2p.c

@@ -553,15 +553,12 @@ static bool
 wlan_hdd_allow_sap_add(struct hdd_context *hdd_ctx, const char *name,
 		       struct wireless_dev **sap_dev)
 {
-	hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
-	QDF_STATUS status;
 	struct hdd_adapter *adapter;
 
 	*sap_dev = NULL;
-	status = hdd_get_front_adapter(hdd_ctx, &adapter_node);
-	while (adapter_node && QDF_IS_STATUS_SUCCESS(status)) {
-		adapter = adapter_node->adapter;
-		if (adapter && adapter->device_mode == QDF_SAP_MODE &&
+
+	hdd_for_each_adapter(hdd_ctx, adapter) {
+		if (adapter->device_mode == QDF_SAP_MODE &&
 		    test_bit(NET_DEVICE_REGISTERED, &adapter->event_flags) &&
 		    !strncmp(adapter->dev->name, name, IFNAMSIZ)) {
 			struct hdd_beacon_data *beacon =
@@ -580,8 +577,6 @@ wlan_hdd_allow_sap_add(struct hdd_context *hdd_ctx, const char *name,
 			hdd_err("ieee80211_ptr points to NULL");
 			return false;
 		}
-		status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next);
-		adapter_node = next;
 	}
 
 	return true;

+ 12 - 59
core/hdd/src/wlan_hdd_power.c

@@ -1079,10 +1079,8 @@ static int
 hdd_suspend_wlan(void)
 {
 	struct hdd_context *hdd_ctx;
-
 	QDF_STATUS status;
 	struct hdd_adapter *adapter = NULL;
-	hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
 	uint32_t conn_state_mask = 0;
 
 	hdd_info("WLAN being suspended by OS");
@@ -1099,12 +1097,10 @@ hdd_suspend_wlan(void)
 		return -EINVAL;
 	}
 
-	status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode);
-	while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) {
-		adapter = pAdapterNode->adapter;
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		if (wlan_hdd_validate_session_id(adapter->session_id)) {
 			hdd_err("invalid session id: %d", adapter->session_id);
-			goto next_adapter;
+			continue;
 		}
 
 		/* stop all TX queues before suspend */
@@ -1119,9 +1115,6 @@ hdd_suspend_wlan(void)
 		/* Configure supported OffLoads */
 		hdd_enable_host_offloads(adapter, pmo_apps_suspend);
 		hdd_update_conn_state_mask(adapter, &conn_state_mask);
-next_adapter:
-		status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext);
-		pAdapterNode = pNext;
 	}
 
 	status = pmo_ucfg_psoc_user_space_suspend_req(hdd_ctx->hdd_psoc,
@@ -1144,7 +1137,6 @@ static int hdd_resume_wlan(void)
 {
 	struct hdd_context *hdd_ctx;
 	struct hdd_adapter *adapter = NULL;
-	hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
 	QDF_STATUS status;
 
 	hdd_info("WLAN being resumed by OS");
@@ -1165,13 +1157,10 @@ static int hdd_resume_wlan(void)
 	hdd_wlan_suspend_resume_event(HDD_WLAN_EARLY_RESUME);
 
 	/*loop through all adapters. Concurrency */
-	status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode);
-
-	while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) {
-		adapter = pAdapterNode->adapter;
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		if (wlan_hdd_validate_session_id(adapter->session_id)) {
 			hdd_err("invalid session id: %d", adapter->session_id);
-			goto next_adapter;
+			continue;
 		}
 		/* Disable supported OffLoads */
 		hdd_disable_host_offloads(adapter, pmo_apps_resume);
@@ -1184,11 +1173,8 @@ static int hdd_resume_wlan(void)
 
 		if (adapter->device_mode == QDF_STA_MODE)
 			status = hdd_disable_default_pkt_filters(adapter);
-
-next_adapter:
-		status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext);
-		pAdapterNode = pNext;
 	}
+
 	hdd_ipa_resume(hdd_ctx);
 	status = pmo_ucfg_psoc_user_space_resume_req(hdd_ctx->hdd_psoc,
 			QDF_SYSTEM_SUSPEND);
@@ -1224,23 +1210,17 @@ void hdd_svc_fw_shutdown_ind(struct device *dev)
  */
 static void hdd_ssr_restart_sap(struct hdd_context *hdd_ctx)
 {
-	QDF_STATUS  status;
-	hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
 	struct hdd_adapter *adapter;
 
 	ENTER();
 
-	status =  hdd_get_front_adapter(hdd_ctx, &adapter_node);
-	while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) {
-		adapter = adapter_node->adapter;
-		if (adapter && adapter->device_mode == QDF_SAP_MODE) {
+	hdd_for_each_adapter(hdd_ctx, adapter) {
+		if (adapter->device_mode == QDF_SAP_MODE) {
 			if (test_bit(SOFTAP_INIT_DONE, &adapter->event_flags)) {
 				hdd_debug("Restart prev SAP session");
 				wlan_hdd_start_sap(adapter, true);
 			}
 		}
-		status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next);
-		adapter_node = next;
 	}
 
 	EXIT();
@@ -1344,13 +1324,9 @@ static inline void hdd_wlan_ssr_reinit_event(void)
  */
 static void hdd_send_default_scan_ies(struct hdd_context *hdd_ctx)
 {
-	hdd_adapter_list_node_t *adapter_node, *next;
 	struct hdd_adapter *adapter;
-	QDF_STATUS status;
 
-	status = hdd_get_front_adapter(hdd_ctx, &adapter_node);
-	while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) {
-		adapter = adapter_node->adapter;
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		if (hdd_is_interface_up(adapter) &&
 		    (adapter->device_mode == QDF_STA_MODE ||
 		    adapter->device_mode == QDF_P2P_DEVICE_MODE)) {
@@ -1359,9 +1335,6 @@ static void hdd_send_default_scan_ies(struct hdd_context *hdd_ctx)
 				      adapter->scan_info.default_scan_ies,
 				      adapter->scan_info.default_scan_ies_len);
 		}
-		status = hdd_get_next_adapter(hdd_ctx, adapter_node,
-					      &next);
-		adapter_node = next;
 	}
 }
 
@@ -1709,10 +1682,8 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
 #endif
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
 	p_cds_sched_context cds_sched_context = get_cds_sched_ctxt();
-	hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL;
 	struct hdd_adapter *adapter;
 	struct hdd_scan_info *scan_info;
-	QDF_STATUS status;
 	int rc;
 
 	ENTER();
@@ -1738,13 +1709,10 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
 	 * "dfs_cac_block_tx" is set to true when RADAR is found and stay true
 	 * until CAC is done for a SoftAP which is in started state.
 	 */
-	status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode);
-	while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) {
-		adapter = pAdapterNode->adapter;
-
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		if (wlan_hdd_validate_session_id(adapter->session_id)) {
 			hdd_err("invalid session id: %d", adapter->session_id);
-			goto next_adapter;
+			continue;
 		}
 
 		if (QDF_SAP_MODE == adapter->device_mode) {
@@ -1773,15 +1741,10 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
 				return -EOPNOTSUPP;
 			}
 		}
-next_adapter:
-		status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext);
-		pAdapterNode = pNext;
 	}
 
 	/* Stop ongoing scan on each interface */
-	status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode);
-	while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) {
-		adapter = pAdapterNode->adapter;
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		scan_info = &adapter->scan_info;
 
 		if (sme_neighbor_middle_of_roaming
@@ -1794,22 +1757,12 @@ next_adapter:
 
 		wlan_abort_scan(hdd_ctx->hdd_pdev, INVAL_PDEV_ID,
 				adapter->session_id, INVALID_SCAN_ID, false);
-
-		status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext);
-		pAdapterNode = pNext;
 	}
 
 	/* flush any pending powersave timers */
-	status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode);
-	while (pAdapterNode && QDF_IS_STATUS_SUCCESS(status)) {
-		adapter = pAdapterNode->adapter;
-
+	hdd_for_each_adapter(hdd_ctx, adapter)
 		sme_ps_timer_flush_sync(hdd_ctx->hHal, adapter->session_id);
 
-		status = hdd_get_next_adapter(hdd_ctx, pAdapterNode,
-					      &pAdapterNode);
-	}
-
 	/*
 	 * Suspend IPA early before proceeding to suspend other entities like
 	 * firmware to avoid any race conditions.

+ 3 - 14
core/hdd/src/wlan_hdd_wext.c

@@ -10333,16 +10333,12 @@ int hdd_reg_set_band(struct net_device *dev, u8 ui_band)
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
 	enum band_info band;
-
 	QDF_STATUS status;
 	struct hdd_context *hdd_ctx;
-	hdd_adapter_list_node_t *pAdapterNode, *pNext;
 	enum band_info currBand;
 	enum band_info connectedBand;
 	long lrc;
 
-	pAdapterNode = NULL;
-	pNext = NULL;
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 
 	switch (ui_band) {
@@ -10394,9 +10390,7 @@ int hdd_reg_set_band(struct net_device *dev, u8 ui_band)
 	hdd_debug("Current band value = %u, new setting %u ",
 			currBand, band);
 
-	status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode);
-	while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) {
-		adapter = pAdapterNode->adapter;
+	hdd_for_each_adapter(hdd_ctx, adapter) {
 		hHal = WLAN_HDD_GET_HAL_CTX(adapter);
 		wlan_abort_scan(hdd_ctx->hdd_pdev, INVAL_PDEV_ID,
 				adapter->session_id, INVALID_SCAN_ID, false);
@@ -10445,15 +10439,10 @@ int hdd_reg_set_band(struct net_device *dev, u8 ui_band)
 		}
 
 		sme_scan_flush_result(hHal);
-
-		status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext);
-		pAdapterNode = pNext;
 	}
 
-	if (QDF_STATUS_SUCCESS !=
-			ucfg_reg_set_band(hdd_ctx->hdd_pdev, band)) {
-		hdd_err("Failed to set the band value to %u",
-				band);
+	if (QDF_IS_STATUS_ERROR(ucfg_reg_set_band(hdd_ctx->hdd_pdev, band))) {
+		hdd_err("Failed to set the band value to %u", band);
 		return -EINVAL;
 	}
 

Some files were not shown because too many files changed in this diff