msm: mdss: fix double sync fence put in buf sync function

If an error occurs after setting acquire fds, the list of sync fences
will be put for cleanup. However if mdss_fb_wait_for_fence() is called
this will also wait and clear the list of fences, since we are relying
on local variable for cleanup, it may not reflect the state after the
function call. Fix this by maintaining the proper state of the list.

CRs-fixed: 548042
Change-Id: I4885eb393ac9bd2b4818292b9a60f53fb4baacc8
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Fix race condition during device shutdown

During device shutdown or restart, two separate contexts can call
mdss_fb_release. One system shutdown/restart thread which calls
shutdown routine registered through device driver. Other closing
of frame buffer devices from user processes. Fix race condition
between these two contexts by using proper locking mechanism and
releasing all the resources.

Change-Id: I583b0f1273d984215e276daf3b6307f3b6e9e8c6
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>