From a246809e2c61c3a4dbdb6092636e7967a78cc758 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Mon, 21 Mar 2016 17:35:36 +0530 Subject: [PATCH] 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 --- core/cds/src/cds_sched.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c index cf0983c0f94f..bbf9b754d775 100644 --- a/core/cds/src/cds_sched.c +++ b/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);