Bläddra i källkod

qcacmn: Move the lock initialization to module open for policy manager

Move the lock initialization to module open from module enable for policy
manager.

Change-Id: I44716537dcb3f559c1c27401bb579239c98a9f02
CRs-Fixed: 2009818
Tushnim Bhattacharyya 8 år sedan
förälder
incheckning
1f1ccf7b8b

+ 1 - 1
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h

@@ -35,7 +35,7 @@
  */
 
 /* Include files */
-#include "wmi_unified.h"
+#include <wmi_unified_api.h>
 
 #define POLICY_MGR_MAX_CHANNEL_LIST 128
 

+ 22 - 15
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c

@@ -318,7 +318,21 @@ QDF_STATUS policy_mgr_deinit(void)
 
 QDF_STATUS policy_mgr_psoc_open(struct wlan_objmgr_psoc *psoc)
 {
-	/* placeholder for now */
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_create(
+		&pm_ctx->qdf_conc_list_lock))) {
+		policy_mgr_err("Failed to init qdf_conc_list_lock");
+		QDF_ASSERT(0);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -332,6 +346,13 @@ QDF_STATUS policy_mgr_psoc_close(struct wlan_objmgr_psoc *psoc)
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_destroy(
+		&pm_ctx->qdf_conc_list_lock))) {
+		policy_mgr_err("Failed to destroy qdf_conc_list_lock");
+		QDF_ASSERT(0);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	if (pm_ctx->hw_mode.hw_mode_list) {
 		qdf_mem_free(pm_ctx->hw_mode.hw_mode_list);
 		pm_ctx->hw_mode.hw_mode_list = NULL;
@@ -374,13 +395,6 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc)
 		return status;
 	}
 
-	if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_create(
-		&pm_ctx->qdf_conc_list_lock))) {
-		policy_mgr_err("Failed to init qdf_conc_list_lock");
-		QDF_ASSERT(0);
-		return status;
-	}
-
 	pm_ctx->do_hw_mode_change = false;
 	pm_ctx->hw_mode_change_in_progress = POLICY_MGR_HW_MODE_NOT_IN_PROGRESS;
 	/* reset sap mandatory channels */
@@ -440,13 +454,6 @@ QDF_STATUS policy_mgr_psoc_disable(struct wlan_objmgr_psoc *psoc)
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_destroy(
-		&pm_ctx->qdf_conc_list_lock))) {
-		policy_mgr_err("Failed to destroy qdf_conc_list_lock");
-		status = QDF_STATUS_E_FAILURE;
-		QDF_ASSERT(0);
-	}
-
 	/* destroy connection_update_done_evt */
 	if (!QDF_IS_STATUS_SUCCESS(qdf_event_destroy
 		(&pm_ctx->connection_update_done_evt))) {