Browse Source

qcacld-3.0: Fix all comments given as part of IBSS+STA code changes

Fix all the comments given during code review of IBSS+STA changes.

Change-Id: If675f55b612f9412c803fc3587a352c9967d1fbe
CRs-Fixed: 963738
Krunal Soni 9 years ago
parent
commit
09b5e5528b

+ 1 - 0
core/cds/inc/cds_concurrency.h

@@ -556,6 +556,7 @@ void cds_decr_active_session(enum tCDF_ADAPTER_MODE mode,
 void cds_decr_session_set_pcl(enum tCDF_ADAPTER_MODE mode,
 		uint8_t session_id);
 CDF_STATUS cds_init_policy_mgr(void);
+CDF_STATUS cds_deinit_policy_mgr(void);
 CDF_STATUS cds_get_pcl(enum cds_con_mode mode,
 				uint8_t *pcl_Channels, uint32_t *len);
 bool cds_allow_concurrency(enum cds_con_mode mode,

+ 1 - 0
core/cds/inc/cds_sched.h

@@ -285,6 +285,7 @@ typedef struct _cds_context_type {
 	struct cds_log_complete log_complete;
 	cdf_spinlock_t bug_report_lock;
 	cdf_event_t connection_update_done_evt;
+	cdf_mutex_t cdf_conc_list_lock;
 
 } cds_context_type, *p_cds_contextType;
 

+ 146 - 54
core/cds/src/cds_concurrency.c

@@ -2195,15 +2195,15 @@ static void cds_update_hw_mode_conn_info(uint32_t num_vdev_mac_entries,
 				       struct sir_hw_mode_params hw_mode)
 {
 	uint32_t i, conn_index, found;
-	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
-	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
-	if (0 != wlan_hdd_validate_context(hdd_ctx)) {
-		cds_err("Invalid HDD Context");
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
 		return;
 	}
 
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	for (i = 0; i < num_vdev_mac_entries; i++) {
 		conn_index = 0;
 		found = 0;
@@ -2236,7 +2236,7 @@ static void cds_update_hw_mode_conn_info(uint32_t num_vdev_mac_entries,
 			  conc_connection_list[conn_index].rx_spatial_stream);
 		}
 	}
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 }
 
 /**
@@ -3515,6 +3515,7 @@ void cds_incr_active_session(enum tCDF_ADAPTER_MODE mode,
 				  uint8_t session_id)
 {
 	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
 	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -3522,11 +3523,17 @@ void cds_incr_active_session(enum tCDF_ADAPTER_MODE mode,
 		return;
 	}
 
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return;
+	}
+
 	/*
 	 * Need to aquire mutex as entire functionality in this function
 	 * is in critical section
 	 */
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	switch (mode) {
 	case CDF_STA_MODE:
 	case CDF_P2P_CLIENT_MODE:
@@ -3551,7 +3558,7 @@ void cds_incr_active_session(enum tCDF_ADAPTER_MODE mode,
 		cds_info("Set PCL of STA to FW");
 	}
 	cds_incr_connection_count(session_id);
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 }
 
 /**
@@ -3680,6 +3687,7 @@ void cds_decr_session_set_pcl(enum tCDF_ADAPTER_MODE mode,
 {
 	CDF_STATUS cdf_status;
 	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
 	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -3687,6 +3695,12 @@ void cds_decr_session_set_pcl(enum tCDF_ADAPTER_MODE mode,
 		return;
 	}
 
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return;
+	}
+
 	cds_decr_active_session(mode, session_id);
 	/*
 	 * After the removal of this connection, we need to check if
@@ -3702,7 +3716,7 @@ void cds_decr_session_set_pcl(enum tCDF_ADAPTER_MODE mode,
 	 * given to the FW. After setting the PCL, we need to restore
 	 * the entry that we have saved before.
 	 */
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	cds_set_pcl_for_existing_combo(CDS_STA_MODE);
 	/* do we need to change the HW mode */
 	if (cds_need_opportunistic_upgrade()) {
@@ -3715,7 +3729,7 @@ void cds_decr_session_set_pcl(enum tCDF_ADAPTER_MODE mode,
 		if (!CDF_IS_STATUS_SUCCESS(cdf_status))
 			cds_err("Failed to start dbs opportunistic timer");
 	}
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 
 	return;
 }
@@ -3736,6 +3750,7 @@ void cds_decr_active_session(enum tCDF_ADAPTER_MODE mode,
 				  uint8_t session_id)
 {
 	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
 	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -3743,11 +3758,17 @@ void cds_decr_active_session(enum tCDF_ADAPTER_MODE mode,
 		return;
 	}
 
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return;
+	}
+
 	/*
 	 * Need to aquire mutex as entire functionality in this function
 	 * is in critical section
 	 */
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	switch (mode) {
 	case CDF_STA_MODE:
 	case CDF_P2P_CLIENT_MODE:
@@ -3763,7 +3784,7 @@ void cds_decr_active_session(enum tCDF_ADAPTER_MODE mode,
 	cds_info("No.# of active sessions for mode %d = %d",
 		mode, hdd_ctx->no_of_active_sessions[mode]);
 	cds_decr_connection_count(session_id);
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 }
 
 /**
@@ -3777,15 +3798,16 @@ void cds_decr_active_session(enum tCDF_ADAPTER_MODE mode,
  */
 void cds_dbs_opportunistic_timer_handler(void *data)
 {
-	hdd_context_t *hdd_ctx = (hdd_context_t *) data;
 	enum cds_conc_next_action action = CDS_NOP;
+	cds_context_type *cds_ctx;
 
-	if (NULL == hdd_ctx) {
-		cds_err("hdd_ctx is NULL");
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
 		return;
 	}
 
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	/* if we still need it */
 	action = cds_need_opportunistic_upgrade();
 	if (action) {
@@ -3797,8 +3819,33 @@ void cds_dbs_opportunistic_timer_handler(void *data)
 		cds_next_actions(0, action,
 				CDS_UPDATE_REASON_OPPORTUNISTIC);
 	}
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
+
+}
+
+/**
+ * cds_deinit_policy_mgr() - Deinitialize the policy manager
+ * related data structures
+ *
+ * Deinitialize the policy manager related data structures
+ *
+ * Return: Success if the policy manager is deinitialized completely
+ */
+CDF_STATUS cds_deinit_policy_mgr(void)
+{
+	cds_context_type *cds_ctx;
 
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return CDF_STATUS_E_FAILURE;
+	}
+	if (!CDF_IS_STATUS_SUCCESS(cdf_mutex_destroy(
+					&cds_ctx->cdf_conc_list_lock))) {
+		cds_err("Failed to destroy cdf_conc_list_lock");
+		return CDF_STATUS_E_FAILURE;
+	}
+	return CDF_STATUS_SUCCESS;
 }
 
 /**
@@ -3813,6 +3860,7 @@ CDF_STATUS cds_init_policy_mgr(void)
 {
 	CDF_STATUS status;
 	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
 	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -3820,14 +3868,20 @@ CDF_STATUS cds_init_policy_mgr(void)
 		return CDF_STATUS_E_FAILURE;
 	}
 
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return CDF_STATUS_E_FAILURE;
+	}
+
 	cds_debug("Initializing the policy manager");
 
 	/* init conc_connection_list */
 	cdf_mem_zero(conc_connection_list, sizeof(conc_connection_list));
 
 	if (!CDF_IS_STATUS_SUCCESS(cdf_mutex_init(
-					&hdd_ctx->hdd_conc_list_lock))) {
-		cds_err("Failed to init hdd_conc_list_lock");
+					&cds_ctx->cdf_conc_list_lock))) {
+		cds_err("Failed to init cdf_conc_list_lock");
 		/* Lets us not proceed further */
 		return CDF_STATUS_E_FAILURE;
 	}
@@ -3964,6 +4018,7 @@ CDF_STATUS cds_incr_connection_count(uint32_t vdev_id)
 	uint32_t conn_index;
 	struct wma_txrx_node *wma_conn_table_entry;
 	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
 	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -3971,6 +4026,12 @@ CDF_STATUS cds_incr_connection_count(uint32_t vdev_id)
 		return status;
 	}
 
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return status;
+	}
+
 	conn_index = cds_get_connection_count();
 	if (hdd_ctx->config->gMaxConcurrentActiveSessions < conn_index) {
 		/* err msg */
@@ -4024,15 +4085,15 @@ CDF_STATUS cds_update_connection_info(uint32_t vdev_id)
 	uint32_t conn_index = 0;
 	bool found = false;
 	struct wma_txrx_node *wma_conn_table_entry;
-	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
-	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
-	if (!hdd_ctx) {
-		cds_err("HDD context is NULL");
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
 		return status;
 	}
 
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	while (CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) {
 		if (vdev_id == conc_connection_list[conn_index].vdev_id) {
 			/* debug msg */
@@ -4043,7 +4104,7 @@ CDF_STATUS cds_update_connection_info(uint32_t vdev_id)
 	}
 	if (!found) {
 		/* err msg */
-		cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+		cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 		cds_err("can't find vdev_id %d in conc_connection_list",
 			vdev_id);
 		return status;
@@ -4053,7 +4114,7 @@ CDF_STATUS cds_update_connection_info(uint32_t vdev_id)
 
 	if (NULL == wma_conn_table_entry) {
 		/* err msg*/
-		cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+		cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 		cds_err("can't find vdev_id %d in WMA table", vdev_id);
 		return status;
 	}
@@ -4068,7 +4129,7 @@ CDF_STATUS cds_update_connection_info(uint32_t vdev_id)
 			wma_conn_table_entry->tx_streams,
 			wma_conn_table_entry->rx_streams,
 			wma_conn_table_entry->nss, vdev_id, true);
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 	return CDF_STATUS_SUCCESS;
 }
 
@@ -4763,6 +4824,7 @@ bool cds_is_ibss_conn_exist(uint8_t *ibss_channel)
 	uint32_t count = 0, index = 0;
 	uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS];
 	bool status = false;
+
 	if (NULL == ibss_channel) {
 		cds_err("Null pointer error");
 		return false;
@@ -4802,6 +4864,7 @@ bool cds_allow_concurrency(enum cds_con_mode mode,
 	bool status = false, match = false;
 	uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS];
 	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
 	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -4809,7 +4872,13 @@ bool cds_allow_concurrency(enum cds_con_mode mode,
 		return status;
 	}
 
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return status;
+	}
+
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	/* find the current connection state from conc_connection_list*/
 	num_connections = cds_get_connection_count();
 
@@ -4996,7 +5065,7 @@ bool cds_allow_concurrency(enum cds_con_mode mode,
 	status = true;
 
 done:
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 	return status;
 }
 
@@ -5478,9 +5547,16 @@ CDF_STATUS cds_current_connections_update(uint32_t session_id,
 	enum cds_one_connection_mode second_index = 0;
 	enum cds_two_connection_mode third_index = 0;
 	enum cds_band band;
+	cds_context_type *cds_ctx;
 	hdd_context_t *hdd_ctx;
 	CDF_STATUS status = CDF_STATUS_E_FAILURE;
 
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return status;
+	}
+
 	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
 		cds_err("Invalid HDD context");
@@ -5496,7 +5572,7 @@ CDF_STATUS cds_current_connections_update(uint32_t session_id,
 	else
 		band = CDS_BAND_5;
 
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	num_connections = cds_get_connection_count();
 
 	cds_debug("num_connections=%d channel=%d",
@@ -5553,7 +5629,7 @@ CDF_STATUS cds_current_connections_update(uint32_t session_id,
 		reason, session_id);
 
 done:
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 	return status;
 }
 
@@ -5627,7 +5703,7 @@ bool cds_wait_for_nss_update(uint8_t action)
 void cds_nss_update_cb(void *context, uint8_t tx_status, uint8_t vdev_id,
 				uint8_t next_action)
 {
-	hdd_context_t *hdd_ctx = (hdd_context_t *)context;
+	cds_context_type *cds_ctx;
 	uint32_t conn_index = 0;
 	bool wait = true;
 
@@ -5635,18 +5711,20 @@ void cds_nss_update_cb(void *context, uint8_t tx_status, uint8_t vdev_id,
 		cds_err("nss update failed for vdev %d", vdev_id);
 		return;
 	}
-	if (NULL == hdd_ctx) {
-		cds_err("NULL hdd_ctx");
+
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
 		return;
 	}
 
-	/**
+	/*
 	 * Check if we are ok to request for HW mode change now
 	 */
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	conn_index = cds_get_connection_for_vdev_id(vdev_id);
 	if (MAX_NUMBER_OF_CONC_CONNECTIONS == conn_index) {
-		cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+		cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 		cds_err("connection not found for vdev %d", vdev_id);
 		return;
 	}
@@ -5669,7 +5747,7 @@ void cds_nss_update_cb(void *context, uint8_t tx_status, uint8_t vdev_id,
 		cds_next_actions(vdev_id,
 				next_action,
 				CDS_UPDATE_REASON_NSS_UPDATE);
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 	return;
 }
 
@@ -7273,6 +7351,7 @@ void cds_check_and_restart_sap_with_non_dfs_acs(void)
 {
 	hdd_adapter_t *ap_adapter;
 	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
 	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -7280,6 +7359,12 @@ void cds_check_and_restart_sap_with_non_dfs_acs(void)
 		return;
 	}
 
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return;
+	}
+
 	if (cds_get_concurrency_mode() != (CDF_STA_MASK | CDF_SAP_MASK)) {
 		cds_info("Concurrency mode is not SAP");
 		return;
@@ -7310,15 +7395,15 @@ CDF_STATUS cds_update_connection_info_utfw(
 {
 	CDF_STATUS status = CDF_STATUS_E_FAILURE;
 	uint32_t conn_index = 0, found = 0;
-	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
-	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
-	if (!hdd_ctx) {
-		cds_err("HDD context is NULL");
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
 		return status;
 	}
 
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	while (CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) {
 		if (vdev_id == conc_connection_list[conn_index].vdev_id) {
 			/* debug msg */
@@ -7329,7 +7414,7 @@ CDF_STATUS cds_update_connection_info_utfw(
 	}
 	if (!found) {
 		/* err msg */
-		cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+		cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 		cds_err("can't find vdev_id %d in conc_connection_list",
 			vdev_id);
 		return status;
@@ -7340,7 +7425,7 @@ CDF_STATUS cds_update_connection_info_utfw(
 			cds_get_mode(type, sub_type),
 			channelid, mac_id, chain_mask, tx_streams,
 			rx_streams, 0, vdev_id, true);
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 
 	return CDF_STATUS_SUCCESS;
 }
@@ -7353,6 +7438,7 @@ CDF_STATUS cds_incr_connection_count_utfw(
 	CDF_STATUS status = CDF_STATUS_E_FAILURE;
 	uint32_t conn_index = 0;
 	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
 	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
 	if (!hdd_ctx) {
@@ -7360,11 +7446,17 @@ CDF_STATUS cds_incr_connection_count_utfw(
 		return status;
 	}
 
-	cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
+		return status;
+	}
+
+	cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 	conn_index = cds_get_connection_count();
 	if (MAX_NUMBER_OF_CONC_CONNECTIONS <= conn_index) {
 		/* err msg */
-		cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+		cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 		cds_err("exceeded max connection limit %d",
 			MAX_NUMBER_OF_CONC_CONNECTIONS);
 		return status;
@@ -7375,7 +7467,7 @@ CDF_STATUS cds_incr_connection_count_utfw(
 			     cds_get_mode(type, sub_type),
 			     channelid, mac_id, chain_mask, tx_streams,
 			     rx_streams, 0, vdev_id, true);
-	cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+	cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 
 	return CDF_STATUS_SUCCESS;
 }
@@ -7384,11 +7476,11 @@ CDF_STATUS cds_decr_connection_count_utfw(uint32_t del_all,
 	uint32_t vdev_id)
 {
 	CDF_STATUS status;
-	hdd_context_t *hdd_ctx;
+	cds_context_type *cds_ctx;
 
-	hdd_ctx = cds_get_context(CDF_MODULE_ID_HDD);
-	if (!hdd_ctx) {
-		cds_err("HDD context is NULL");
+	cds_ctx = cds_get_context(CDF_MODULE_ID_CDF);
+	if (!cds_ctx) {
+		cds_err("Invalid CDS Context");
 		return CDF_STATUS_E_FAILURE;
 	}
 
@@ -7399,9 +7491,9 @@ CDF_STATUS cds_decr_connection_count_utfw(uint32_t del_all,
 			return CDF_STATUS_E_FAILURE;
 		}
 	} else {
-		cdf_mutex_acquire(&hdd_ctx->hdd_conc_list_lock);
+		cdf_mutex_acquire(&cds_ctx->cdf_conc_list_lock);
 		cds_decr_connection_count(vdev_id);
-		cdf_mutex_release(&hdd_ctx->hdd_conc_list_lock);
+		cdf_mutex_release(&cds_ctx->cdf_conc_list_lock);
 	}
 
 	return CDF_STATUS_SUCCESS;

+ 0 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -1322,7 +1322,6 @@ struct hdd_context_s {
 	cdf_mc_timer_t dbs_opportunistic_timer;
 	bool connection_in_progress;
 	cdf_spinlock_t connection_status_lock;
-	cdf_mutex_t hdd_conc_list_lock;
 
 	uint16_t hdd_txrx_hist_idx;
 	struct hdd_tx_rx_histogram hdd_txrx_hist[NUM_TX_RX_HISTOGRAM];

+ 4 - 6
core/hdd/src/wlan_hdd_main.c

@@ -3811,9 +3811,8 @@ void hdd_wlan_exit(hdd_context_t *hdd_ctx)
 	cdf_list_destroy(&hdd_ctx->hdd_roc_req_q);
 	cdf_list_destroy(&hdd_ctx->hdd_scan_req_q);
 
-	if (!CDF_IS_STATUS_SUCCESS(cdf_mutex_destroy(
-				&hdd_ctx->hdd_conc_list_lock))) {
-		hdd_err("Failed to destroy hdd_conc_list_lock");
+	if (!CDF_IS_STATUS_SUCCESS(cds_deinit_policy_mgr())) {
+		hdd_err("Failed to deinit policy manager");
 		/* Proceed and complete the clean up */
 	}
 
@@ -5806,9 +5805,8 @@ err_nl_srv:
 #endif /* WLAN_KD_READY_NOTIFIER */
 	nl_srv_exit();
 
-	if (!CDF_IS_STATUS_SUCCESS
-			(cdf_mutex_destroy(&hdd_ctx->hdd_conc_list_lock))) {
-		hdd_err("Failed to destroy hdd_conc_list_lock");
+	if (!CDF_IS_STATUS_SUCCESS(cds_deinit_policy_mgr())) {
+		hdd_err("Failed to deinit policy manager");
 		/* Proceed and complete the clean up */
 	}
 

+ 2 - 3
core/hdd/src/wlan_hdd_power.c

@@ -1631,9 +1631,8 @@ err_cds_close:
 		wiphy_unregister(pHddCtx->wiphy);
 		wiphy_free(pHddCtx->wiphy);
 
-		if (!CDF_IS_STATUS_SUCCESS(cdf_mutex_destroy(
-					&pHddCtx->hdd_conc_list_lock))) {
-			hdd_err("Failed to destroy hdd_conc_list_lock");
+		if (!CDF_IS_STATUS_SUCCESS(cds_deinit_policy_mgr())) {
+			hdd_err("Failed to deinit policy manager");
 			/* Proceed and complete the clean up */
 		}
 	}

+ 3 - 4
core/sme/src/csr/csr_api_scan.c

@@ -5305,7 +5305,6 @@ static void csr_scan_copy_request_valid_channels_only(tpAniSirGlobal mac_ctx,
 static bool csr_scan_filter_ibss_chnl_band(tpAniSirGlobal mac_ctx,
 			uint8_t ibss_channel, tCsrScanRequest *dst_req) {
 	uint8_t valid_chnl_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
-	uint8_t filtered_chnl_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
 	uint32_t filter_chnl_len = 0, i = 0;
 	uint32_t valid_chnl_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
 
@@ -5346,12 +5345,12 @@ static bool csr_scan_filter_ibss_chnl_band(tpAniSirGlobal mac_ctx,
 			continue;
 		if (CDS_IS_CHANNEL_5GHZ(ibss_channel) &&
 			CDS_IS_CHANNEL_24GHZ(valid_chnl_list[i])) {
-			filtered_chnl_list[filter_chnl_len] =
+			valid_chnl_list[filter_chnl_len] =
 					valid_chnl_list[i];
 			filter_chnl_len++;
 		} else if (CDS_IS_CHANNEL_24GHZ(ibss_channel) &&
 			CDS_IS_CHANNEL_5GHZ(valid_chnl_list[i])) {
-			filtered_chnl_list[filter_chnl_len] =
+			valid_chnl_list[filter_chnl_len] =
 					valid_chnl_list[i];
 			filter_chnl_len++;
 		}
@@ -5377,7 +5376,7 @@ static bool csr_scan_filter_ibss_chnl_band(tpAniSirGlobal mac_ctx,
 			FL("Memory allocation failed"));
 		return false;
 	}
-	cdf_mem_copy(dst_req->ChannelInfo.ChannelList, filtered_chnl_list,
+	cdf_mem_copy(dst_req->ChannelInfo.ChannelList, valid_chnl_list,
 			filter_chnl_len);
 	return true;
 }