From 98ca3dac37b044dbc0d86fb5524b6646ae9d2702 Mon Sep 17 00:00:00 2001 From: Gururaj Pandurangi Date: Tue, 14 Jul 2020 13:08:57 -0700 Subject: [PATCH] qcacld-3.0: Acquire mutex lock within MCC policy mgr api Currently, the mutex lock is acquired in the caller functions before calling policy mgr api to check MCC. Remove it and add the mutex lock within the policy manager API instead. Change-Id: I7be6081ed12c1882b808d3ca4e92392d175349e7 CRs-Fixed: 2732055 --- .../policy_mgr/src/wlan_policy_mgr_core.c | 2 -- .../policy_mgr/src/wlan_policy_mgr_get_set_utils.c | 11 +++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c index 5d3006ace0f8..45687f2abc96 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c @@ -621,9 +621,7 @@ void policy_mgr_update_conc_list(struct wlan_objmgr_psoc *psoc, /* IPA only cares about STA or SAP mode */ if (mode == PM_STA_MODE || mode == PM_SAP_MODE) { - qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); mcc_mode = policy_mgr_current_concurrency_is_mcc(psoc); - qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); if (pm_ctx->dp_cbacks.hdd_ipa_set_mcc_mode_cb) pm_ctx->dp_cbacks.hdd_ipa_set_mcc_mode_cb(mcc_mode); diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index b62ce9c52168..3414332bbfd4 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -1562,9 +1562,17 @@ bool policy_mgr_current_concurrency_is_mcc(struct wlan_objmgr_psoc *psoc) { uint32_t num_connections = 0; bool is_mcc = false; + struct policy_mgr_psoc_priv_obj *pm_ctx; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("Invalid Context"); + return is_mcc; + } num_connections = policy_mgr_get_connection_count(psoc); + qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); switch (num_connections) { case 1: break; @@ -1591,6 +1599,7 @@ bool policy_mgr_current_concurrency_is_mcc(struct wlan_objmgr_psoc *psoc) num_connections); break; } + qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); return is_mcc; } @@ -1925,9 +1934,7 @@ QDF_STATUS policy_mgr_decr_active_session(struct wlan_objmgr_psoc *psoc, * or SAP since IPA only cares about these two */ if (mode == QDF_STA_MODE || mode == QDF_SAP_MODE) { - qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); mcc_mode = policy_mgr_current_concurrency_is_mcc(psoc); - qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); if (pm_ctx->dp_cbacks.hdd_ipa_set_mcc_mode_cb) pm_ctx->dp_cbacks.hdd_ipa_set_mcc_mode_cb(mcc_mode);