Browse Source

qcacld-3.0: Init the thread resume wait event before setting suspend event

qcacld-2.0 to qcacld-3.0 propagation

While suspending threads suspend complete event is set before
resume wait event is initialized.

In case resume is followed by suspend there might arise a condition
where resume wait event is set even before its initialization.
Thus after initializing the wait event thread will keep on waiting
on the event and thus get stuck.

To avoid this initialize the thread resume wait event before
setting the suspend event.

Change-Id: Iaffacd23f363f386fbaef4de066784cfd4d9e139
CRs-Fixed: 972287
Abhishek Singh 9 years ago
parent
commit
a246809e2c
1 changed files with 2 additions and 3 deletions
  1. 2 3
      core/cds/src/cds_sched.c

+ 2 - 3
core/cds/src/cds_sched.c

@@ -564,11 +564,10 @@ static int cds_mc_thread(void *Arg)
 				clear_bit(MC_SUSPEND_EVENT_MASK,
 					  &pSchedContext->mcEventFlag);
 				spin_lock(&pSchedContext->McThreadLock);
-
+				INIT_COMPLETION(pSchedContext->ResumeMcEvent);
 				/* Mc Thread Suspended */
 				complete(&pHddCtx->mc_sus_event_var);
 
-				INIT_COMPLETION(pSchedContext->ResumeMcEvent);
 				spin_unlock(&pSchedContext->McThreadLock);
 
 				/* Wait foe Resume Indication */
@@ -866,9 +865,9 @@ static int cds_ol_rx_thread(void *arg)
 				clear_bit(RX_SUSPEND_EVENT_MASK,
 					  &pSchedContext->ol_rx_event_flag);
 				spin_lock(&pSchedContext->ol_rx_thread_lock);
-				complete(&pSchedContext->ol_suspend_rx_event);
 				INIT_COMPLETION
 					(pSchedContext->ol_resume_rx_event);
+				complete(&pSchedContext->ol_suspend_rx_event);
 				spin_unlock(&pSchedContext->ol_rx_thread_lock);
 				wait_for_completion_interruptible
 					(&pSchedContext->ol_resume_rx_event);