drivers: qcom: rpmh: Wakeup only when the wait count is zero

Wakeup the waiting thread only when the wait count is zero. Currently,
if there are two responses coming back that use the same waitq object,
both of these threads would decrement the atomic wait_count variable and
then try to wakeup the waitq object. Since the wait count has been
decremented by both the threads, the waiting thread will see its
condition turning true and therefore would bail out releasing the waitq
object from the stack. The second thread that tries to acquire the waitq
and wake it up will crash.

Change-Id: Ie1f38df8341e3cb8cfca803e89c6d4a430626686
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
1 file changed