From 4923595552bee2e46fbd8cd57015420b7a3c37fa Mon Sep 17 00:00:00 2001 From: Yu Wang Date: Tue, 4 Aug 2020 17:46:08 +0800 Subject: [PATCH] qcacld-3.0: check the state before starting auto ps timer Since sme_ps_enable_auto_ps_timer will be called in different scenarios, and there is error level output if trying to start it when it's already started. To avoid the useless error log, check the state before starting this timer. CRs-Fixed: 2747427 Change-Id: If119da266a991b6b5990ad3077e41c2bba11a798 --- core/sme/src/common/sme_power_save.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/sme/src/common/sme_power_save.c b/core/sme/src/common/sme_power_save.c index 215759cbb2bb..d3ba3ab8fbb0 100644 --- a/core/sme/src/common/sme_power_save.c +++ b/core/sme/src/common/sme_power_save.c @@ -752,6 +752,7 @@ QDF_STATUS sme_ps_enable_auto_ps_timer(mac_handle_t mac_handle, struct ps_global_info *ps_global_info = &mac_ctx->sme.ps_global_info; struct ps_params *ps_param = &ps_global_info->ps_params[session_id]; QDF_STATUS qdf_status; + QDF_TIMER_STATE cur_state; if (!timeout && !mac_ctx->usr_cfg_ps_enable) { sme_debug("auto_ps_timer called with timeout 0; ignore"); @@ -760,8 +761,15 @@ QDF_STATUS sme_ps_enable_auto_ps_timer(mac_handle_t mac_handle, if (!timeout) timeout = AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE; - sme_debug("Start auto_ps_timer for %d ms", timeout); + cur_state = + qdf_mc_timer_get_current_state(&ps_param->auto_ps_enable_timer); + if (cur_state == QDF_TIMER_STATE_STARTING || + cur_state == QDF_TIMER_STATE_RUNNING) { + sme_debug("auto_ps_timer is already started: %d", cur_state); + return QDF_STATUS_SUCCESS; + } + sme_debug("Start auto_ps_timer for %d ms", timeout); qdf_status = qdf_mc_timer_start(&ps_param->auto_ps_enable_timer, timeout); if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { @@ -773,6 +781,7 @@ QDF_STATUS sme_ps_enable_auto_ps_timer(mac_handle_t mac_handle, return QDF_STATUS_E_FAILURE; } } + return QDF_STATUS_SUCCESS; }