Browse Source

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
Yu Wang 4 years ago
parent
commit
4923595552
1 changed files with 10 additions and 1 deletions
  1. 10 1
      core/sme/src/common/sme_power_save.c

+ 10 - 1
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;
 }