Browse Source

qcacmn: Move wakelock outside of spin lock

Wake lock acquire and release API is doing console logging, which has
side effects and hence move wake lock APIs outside spin lock.

Change-Id: Ib697c5fc1b1c44dbeafd94a72cb79e63640cb0d7
CRs-Fixed: 2521000
Alan Chen 5 years ago
parent
commit
7a0394d444
1 changed files with 9 additions and 5 deletions
  1. 9 5
      umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_main.c

+ 9 - 5
umac/cmn_services/mgmt_txrx/core/src/wlan_mgmt_txrx_main.c

@@ -124,13 +124,14 @@ struct mgmt_txrx_desc_elem_t *wlan_mgmt_txrx_desc_get(
 					  entry);
 	mgmt_txrx_desc->in_use = true;
 
+	qdf_spin_unlock_bh(&mgmt_txrx_pdev_ctx->mgmt_desc_pool.desc_pool_lock);
+
 	/* acquire the wakelock when there are pending mgmt tx frames */
 	qdf_wake_lock_timeout_acquire(&mgmt_txrx_pdev_ctx->wakelock_tx_cmp,
 				      MGMT_TXRX_WAKELOCK_TIMEOUT_TX_CMP);
 	qdf_runtime_pm_prevent_suspend(
 		&mgmt_txrx_pdev_ctx->wakelock_tx_runtime_cmp);
 
-	qdf_spin_unlock_bh(&mgmt_txrx_pdev_ctx->mgmt_desc_pool.desc_pool_lock);
 
 	return mgmt_txrx_desc;
 }
@@ -140,6 +141,7 @@ void wlan_mgmt_txrx_desc_put(
 			uint32_t desc_id)
 {
 	struct mgmt_txrx_desc_elem_t *desc;
+	bool release_wakelock = false;
 
 	desc = &mgmt_txrx_pdev_ctx->mgmt_desc_pool.pool[desc_id];
 	qdf_spin_lock_bh(&mgmt_txrx_pdev_ctx->mgmt_desc_pool.desc_pool_lock);
@@ -162,13 +164,15 @@ void wlan_mgmt_txrx_desc_put(
 
 	/* release the wakelock if there are no pending mgmt tx frames */
 	if (mgmt_txrx_pdev_ctx->mgmt_desc_pool.free_list.count ==
-	    mgmt_txrx_pdev_ctx->mgmt_desc_pool.free_list.max_size) {
+	    mgmt_txrx_pdev_ctx->mgmt_desc_pool.free_list.max_size)
+		release_wakelock = true;
+
+	qdf_spin_unlock_bh(&mgmt_txrx_pdev_ctx->mgmt_desc_pool.desc_pool_lock);
+
+	if (release_wakelock) {
 		qdf_runtime_pm_allow_suspend(
 			&mgmt_txrx_pdev_ctx->wakelock_tx_runtime_cmp);
 		qdf_wake_lock_release(&mgmt_txrx_pdev_ctx->wakelock_tx_cmp,
 				      MGMT_TXRX_WAKELOCK_REASON_TX_CMP);
 	}
-
-	qdf_spin_unlock_bh(&mgmt_txrx_pdev_ctx->mgmt_desc_pool.desc_pool_lock);
-
 }