msm: smd: Fix race condition while processing SMSM callback

When SMSM interrupt is received, a snapshot of SMSM callback is stored
in a kfifo. The snapshot is stored as
	a) SMSM state of each subsystem
	b) Wakelock usage information.

Then a work item is scheduled in global workqueue to process the snapshot
and notify the smsm clients. The smsm snapshot is processed as
	1) Lock the snapshot
	2) Retrieve SMSM states from kfifo and process them
	3) Unlock the snapshot
	4) Retrieve Wakelock usage information from kfifo

When back-to-back smsm interrupts are received, multiple work items are
scheduled in multiple cores. The first work item performs steps 1, 2 &
3 and got pre-empted. In the meanwhile the second work item starts
with Wakelock usage information and reports wrong smsm state to the SMSM
clients.

So schedule the work items in a single thread workqueue and interchange
steps 3 & 4 while processing the SMSM snapshot.

CRs-Fixed: 353552
Change-Id: Ic08e242653cc8d1648ad7a70bf7c5f6b7c089c4e
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
1 file changed