From d59db4e8622b347e047d61567766fb76cbde392b Mon Sep 17 00:00:00 2001
From: Shuzhen Wang <shuzhenw@codeaurora.org>
Date: Sun, 16 Mar 2014 23:02:53 -0700
Subject: [PATCH] msm: camera: Do not ignore ERESTARTSYS return from wait
 function

By ignoring ERESTARTSYS return from wait function, the thread
could potentially hold up the freezing of the task for a long
time, causing battery drain.

Bug: 10577806
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Change-Id: I653c06c6bf41b07c811d6bab33e3c839460f45b6
(cherry picked from commit db69933cd572bb7f6fc6ede66175dc4adfdd8217)
---
 drivers/media/platform/msm/camera_v2/msm.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/msm/camera_v2/msm.c b/drivers/media/platform/msm/camera_v2/msm.c
index 747d8d7c4aa1..82d14fba40c4 100644
--- a/drivers/media/platform/msm/camera_v2/msm.c
+++ b/drivers/media/platform/msm/camera_v2/msm.c
@@ -691,14 +691,9 @@ int msm_post_event(struct v4l2_event *event, int timeout)
 		return rc;
 	}
 
-	/* should wait on session based condition */
-	do {
-		rc = wait_event_interruptible_timeout(cmd_ack->wait,
-			!list_empty_careful(&cmd_ack->command_q.list),
-			msecs_to_jiffies(timeout));
-		if (rc != -ERESTARTSYS)
-			break;
-	} while (1);
+	rc = wait_event_interruptible_timeout(cmd_ack->wait,
+		!list_empty_careful(&cmd_ack->command_q.list),
+		msecs_to_jiffies(timeout));
 
 	if (list_empty_careful(&cmd_ack->command_q.list)) {
 		if (!rc) {
-- 
GitLab