Browse Source

qcacld-3.0: Change semantics of Runtime Lock APIs

QDF Runtime PM lock APIs semantics are changed. Incorporate the
changes done in QDF for all the Runtime PM lock APIs.

CRs-fixed: 1116549
Change-Id: Ia701378031b7e9c01583eaef403e1219fdce47e3
Prashanth Bhatta 8 years ago
parent
commit
87b6dc0a9f

+ 6 - 6
core/cds/src/cds_api.c

@@ -1757,14 +1757,14 @@ void cds_trigger_recovery(bool skip_crash_inject)
 		return;
 	}
 
-	recovery_lock = qdf_runtime_lock_init("cds_recovery");
-	if (!recovery_lock) {
+	status = qdf_runtime_lock_init(&recovery_lock);
+	if (QDF_STATUS_SUCCESS != status) {
 		QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
-			"Could not acquire runtime pm lock!");
+			"Could not acquire runtime pm lock: %d!", status);
 		return;
 	}
 
-	qdf_runtime_pm_prevent_suspend(recovery_lock);
+	qdf_runtime_pm_prevent_suspend(&recovery_lock);
 
 	/*
 	 * If force assert thru platform is available, trigger that interface.
@@ -1796,8 +1796,8 @@ void cds_trigger_recovery(bool skip_crash_inject)
 	}
 
 out:
-	qdf_runtime_pm_allow_suspend(recovery_lock);
-	qdf_runtime_lock_deinit(recovery_lock);
+	qdf_runtime_pm_allow_suspend(&recovery_lock);
+	qdf_runtime_lock_deinit(&recovery_lock);
 }
 
 /**

+ 2 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -14613,7 +14613,7 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter,
 			hdd_conn_set_connection_state(pAdapter,
 			eConnectionState_Connecting);
 
-		qdf_runtime_pm_prevent_suspend(pAdapter->connect_rpm_ctx.
+		qdf_runtime_pm_prevent_suspend(&pAdapter->connect_rpm_ctx.
 					       connect);
 		hdd_prevent_suspend_timeout(HDD_WAKELOCK_TIMEOUT_CONNECT,
 					    WIFI_POWER_EVENT_WAKELOCK_CONNECT);
@@ -14632,7 +14632,7 @@ static int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter,
 			/* change back to NotAssociated */
 			hdd_conn_set_connection_state(pAdapter,
 						      eConnectionState_NotConnected);
-			qdf_runtime_pm_allow_suspend(pAdapter->connect_rpm_ctx.
+			qdf_runtime_pm_allow_suspend(&pAdapter->connect_rpm_ctx.
 						     connect);
 			hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_CONNECT);
 		}

+ 2 - 2
core/hdd/src/wlan_hdd_hostapd.c

@@ -164,7 +164,7 @@ static void hdd_hostapd_channel_allow_suspend(hdd_adapter_t *pAdapter,
 		hdd_err("DFS: allowing suspend (chan: %d)", channel);
 		qdf_wake_lock_release(&pHddCtx->sap_dfs_wakelock,
 				      WIFI_POWER_EVENT_WAKELOCK_DFS);
-		qdf_runtime_pm_allow_suspend(pHddCtx->runtime_context.dfs);
+		qdf_runtime_pm_allow_suspend(&pHddCtx->runtime_context.dfs);
 
 	}
 }
@@ -201,7 +201,7 @@ static void hdd_hostapd_channel_prevent_suspend(hdd_adapter_t *pAdapter,
 	/* Acquire wakelock if we have at least one DFS channel in use */
 	if (atomic_inc_return(&pHddCtx->sap_dfs_ref_cnt) == 1) {
 		hdd_err("DFS: preventing suspend (chan: %d)", channel);
-		qdf_runtime_pm_prevent_suspend(pHddCtx->runtime_context.dfs);
+		qdf_runtime_pm_prevent_suspend(&pHddCtx->runtime_context.dfs);
 		qdf_wake_lock_acquire(&pHddCtx->sap_dfs_wakelock,
 				      WIFI_POWER_EVENT_WAKELOCK_DFS);
 	}

+ 9 - 11
core/hdd/src/wlan_hdd_main.c

@@ -2870,8 +2870,8 @@ static void hdd_runtime_suspend_context_init(hdd_context_t *hdd_ctx)
 {
 	struct hdd_runtime_pm_context *ctx = &hdd_ctx->runtime_context;
 
-	ctx->roc = qdf_runtime_lock_init("roc");
-	ctx->dfs = qdf_runtime_lock_init("dfs");
+	qdf_runtime_lock_init(&ctx->roc);
+	qdf_runtime_lock_init(&ctx->dfs);
 }
 
 /**
@@ -2884,10 +2884,8 @@ static void hdd_runtime_suspend_context_deinit(hdd_context_t *hdd_ctx)
 {
 	struct hdd_runtime_pm_context *ctx = &hdd_ctx->runtime_context;
 
-	qdf_runtime_lock_deinit(ctx->roc);
-	ctx->roc = NULL;
-	qdf_runtime_lock_deinit(ctx->dfs);
-	ctx->dfs = NULL;
+	qdf_runtime_lock_deinit(&ctx->roc);
+	qdf_runtime_lock_deinit(&ctx->dfs);
 
 	wlan_scan_runtime_pm_deinit(hdd_ctx->hdd_pdev);
 }
@@ -2896,15 +2894,14 @@ static void hdd_adapter_runtime_suspend_init(hdd_adapter_t *adapter)
 {
 	struct hdd_connect_pm_context *ctx = &adapter->connect_rpm_ctx;
 
-	ctx->connect = qdf_runtime_lock_init("connect");
+	qdf_runtime_lock_init(&ctx->connect);
 }
 
 static void hdd_adapter_runtime_suspend_denit(hdd_adapter_t *adapter)
 {
 	struct hdd_connect_pm_context *ctx = &adapter->connect_rpm_ctx;
 
-	qdf_runtime_lock_deinit(ctx->connect);
-	ctx->connect = NULL;
+	qdf_runtime_lock_deinit(&ctx->connect);
 }
 #else /* FEATURE_RUNTIME_PM */
 static void hdd_runtime_suspend_context_init(hdd_context_t *hdd_ctx) {}
@@ -4738,7 +4735,7 @@ void hdd_connect_result(struct net_device *dev, const u8 *bssid,
 		req_ie_len, resp_ie, resp_ie_len,
 		status, gfp, connect_timeout, timeout_reason);
 
-	qdf_runtime_pm_allow_suspend(padapter->connect_rpm_ctx.connect);
+	qdf_runtime_pm_allow_suspend(&padapter->connect_rpm_ctx.connect);
 	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_CONNECT);
 }
 #else
@@ -4753,7 +4750,8 @@ void hdd_connect_result(struct net_device *dev, const u8 *bssid,
 
 	cfg80211_connect_result(dev, bssid, req_ie, req_ie_len,
 				resp_ie, resp_ie_len, status, gfp);
-	qdf_runtime_pm_allow_suspend(padapter->connect_rpm_ctx.connect);
+
+	qdf_runtime_pm_allow_suspend(&padapter->connect_rpm_ctx.connect);
 	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_CONNECT);
 }
 #endif

+ 7 - 7
core/hdd/src/wlan_hdd_p2p.c

@@ -206,7 +206,7 @@ QDF_STATUS wlan_hdd_remain_on_channel_callback(tHalHandle hHal, void *pCtx,
 	 * roc requests are immediately processed without being queued
 	 */
 	pAdapter->is_roc_inprogress = false;
-	qdf_runtime_pm_allow_suspend(hdd_ctx->runtime_context.roc);
+	qdf_runtime_pm_allow_suspend(&hdd_ctx->runtime_context.roc);
 	/*
 	 * If the allow suspend is done later, the scheduled roc wil prevent
 	 * the system from going into suspend and immediately this logic
@@ -379,7 +379,7 @@ void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter)
 		if (!rc)
 			hdd_err("timeout waiting for cancel remain on channel ready indication");
 
-		qdf_runtime_pm_allow_suspend(hdd_ctx->runtime_context.roc);
+		qdf_runtime_pm_allow_suspend(&hdd_ctx->runtime_context.roc);
 		hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
 	} else
 		mutex_unlock(&cfgState->remain_on_chan_ctx_lock);
@@ -583,7 +583,7 @@ static void wlan_hdd_remain_on_chan_timeout(void *data)
 	}
 
 	hdd_tdls_notify_p2p_roc(hdd_ctx, P2P_ROC_END);
-	qdf_runtime_pm_allow_suspend(hdd_ctx->runtime_context.roc);
+	qdf_runtime_pm_allow_suspend(&hdd_ctx->runtime_context.roc);
 	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
 }
 
@@ -646,7 +646,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter,
 	}
 
 	hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
-	qdf_runtime_pm_prevent_suspend(pHddCtx->runtime_context.roc);
+	qdf_runtime_pm_prevent_suspend(&pHddCtx->runtime_context.roc);
 	INIT_COMPLETION(pAdapter->rem_on_chan_ready_event);
 
 	/* call sme API to start remain on channel. */
@@ -682,7 +682,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter,
 				cfgState->remain_on_chan_ctx = NULL;
 			}
 			mutex_unlock(&cfgState->remain_on_chan_ctx_lock);
-			qdf_runtime_pm_allow_suspend(pHddCtx->runtime_context.
+			qdf_runtime_pm_allow_suspend(&pHddCtx->runtime_context.
 						     roc);
 			hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
 			return -EINVAL;
@@ -723,7 +723,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter,
 				cfgState->remain_on_chan_ctx = NULL;
 			}
 			mutex_unlock(&cfgState->remain_on_chan_ctx_lock);
-			qdf_runtime_pm_allow_suspend(pHddCtx->runtime_context.
+			qdf_runtime_pm_allow_suspend(&pHddCtx->runtime_context.
 						     roc);
 			hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
 			return -EINVAL;
@@ -737,7 +737,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter,
 			wlansap_cancel_remain_on_channel(
 				WLAN_HDD_GET_SAP_CTX_PTR(pAdapter),
 				pRemainChanCtx->scan_id);
-			qdf_runtime_pm_allow_suspend(pHddCtx->runtime_context.
+			qdf_runtime_pm_allow_suspend(&pHddCtx->runtime_context.
 						     roc);
 			hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
 			return -EINVAL;

+ 2 - 2
core/hdd/src/wlan_hdd_power.c

@@ -1918,7 +1918,7 @@ static void hdd_stop_dhcp_ind(hdd_adapter_t *adapter)
 			  adapter->macAddressCurrent.bytes,
 			  adapter->sessionId);
 	hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DHCP);
-	qdf_runtime_pm_allow_suspend(adapter->connect_rpm_ctx.connect);
+	qdf_runtime_pm_allow_suspend(&adapter->connect_rpm_ctx.connect);
 }
 
 /**
@@ -1935,7 +1935,7 @@ static void hdd_start_dhcp_ind(hdd_adapter_t *adapter)
 	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 
 	hdd_debug("DHCP start indicated through power save");
-	qdf_runtime_pm_prevent_suspend(adapter->connect_rpm_ctx.connect);
+	qdf_runtime_pm_prevent_suspend(&adapter->connect_rpm_ctx.connect);
 	hdd_prevent_suspend_timeout(HDD_WAKELOCK_TIMEOUT_CONNECT,
 				    WIFI_POWER_EVENT_WAKELOCK_DHCP);
 	sme_dhcp_start_ind(hdd_ctx->hHal, adapter->device_mode,

+ 3 - 4
core/wma/src/wma_main.c

@@ -2638,8 +2638,7 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, void *cds_context,
 
 	qdf_wake_lock_create(&wma_handle->wmi_cmd_rsp_wake_lock,
 					"wlan_fw_rsp_wakelock");
-	wma_handle->wmi_cmd_rsp_runtime_lock =
-			qdf_runtime_lock_init("wlan_fw_rsp_runtime_lock");
+	qdf_runtime_lock_init(&wma_handle->wmi_cmd_rsp_runtime_lock);
 
 	/* Register peer assoc conf event handler */
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
@@ -2706,7 +2705,7 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, void *cds_context,
 
 err_dbglog_init:
 	qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock);
-	qdf_runtime_lock_deinit(wma_handle->wmi_cmd_rsp_runtime_lock);
+	qdf_runtime_lock_deinit(&wma_handle->wmi_cmd_rsp_runtime_lock);
 	qdf_spinlock_destroy(&wma_handle->vdev_respq_lock);
 	qdf_spinlock_destroy(&wma_handle->wma_hold_req_q_lock);
 err_event_init:
@@ -3730,7 +3729,7 @@ QDF_STATUS wma_close(void *cds_ctx)
 	wma_cleanup_vdev_resp_queue(wma_handle);
 	wma_cleanup_hold_req(wma_handle);
 	qdf_wake_lock_destroy(&wma_handle->wmi_cmd_rsp_wake_lock);
-	qdf_runtime_lock_deinit(wma_handle->wmi_cmd_rsp_runtime_lock);
+	qdf_runtime_lock_deinit(&wma_handle->wmi_cmd_rsp_runtime_lock);
 	for (idx = 0; idx < wma_handle->num_mem_chunks; ++idx) {
 		qdf_mem_free_consistent(wma_handle->qdf_dev,
 					wma_handle->qdf_dev->dev,

+ 2 - 2
core/wma/src/wma_utils.c

@@ -4271,7 +4271,7 @@ void wma_acquire_wakelock(qdf_wake_lock_t *wl, uint32_t msec)
 
 	cds_host_diag_log_work(wl, msec, WIFI_POWER_EVENT_WAKELOCK_WMI_CMD_RSP);
 	qdf_wake_lock_timeout_acquire(wl, msec);
-	qdf_runtime_pm_prevent_suspend(wma->wmi_cmd_rsp_runtime_lock);
+	qdf_runtime_pm_prevent_suspend(&wma->wmi_cmd_rsp_runtime_lock);
 }
 
 void wma_release_wakelock(qdf_wake_lock_t *wl)
@@ -4279,7 +4279,7 @@ void wma_release_wakelock(qdf_wake_lock_t *wl)
 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
 	qdf_wake_lock_release(wl, WIFI_POWER_EVENT_WAKELOCK_WMI_CMD_RSP);
-	qdf_runtime_pm_allow_suspend(wma->wmi_cmd_rsp_runtime_lock);
+	qdf_runtime_pm_allow_suspend(&wma->wmi_cmd_rsp_runtime_lock);
 }
 
 QDF_STATUS