msm: camera: context: Fix race conditions

Before putting a context back to free list ensure that all sync
callback threads have returned, use a refcount on context to
achieve this.

Also, in sync callback thread the submission of request to hardware
and moving that request to active list needs to be in a critical
section because another thread that is flushing the same request
may flush request and we may submit the request to hardware from
the sync callback thread. Use a sync mutex to achieve this.

Change-Id: I07767f1098fb0e1b5aa1bbedd2be2b7f0d1c8ad2
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
6 files changed