summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLakshmi Narayana Kalavala <lkalaval@codeaurora.org>2016-01-13 11:47:41 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:17:14 -0700
commitbbadb94caf09b75ed1f64d0f80f1e643159b930f (patch)
treeeeeef69df317eecfbbcf38666eaf8ddb2eb1188c
parentded1ecfaa734163b7aec54269ed8588899752ed6 (diff)
msm: camera: Cleanup all the command queues upon close node
When the backend camera daemon is crashed for some reason, camera application waits for the completion of the command processing till the timeout is reached which is unnecessary. Hence clean all the command queues when the config node is closed and immediately wake up all the command queues so that camera application is notified immediately. Change-Id: Iff5c331e8c5bb39305087fd4defe332690653b10 Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
-rw-r--r--drivers/media/platform/msm/camera_v2/msm.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/media/platform/msm/camera_v2/msm.c b/drivers/media/platform/msm/camera_v2/msm.c
index f4941e3bc554..03cc05a811ca 100644
--- a/drivers/media/platform/msm/camera_v2/msm.c
+++ b/drivers/media/platform/msm/camera_v2/msm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -614,6 +614,37 @@ static int __msm_close_destry_session_notify_apps(void *d1, void *d2)
return 0;
}
+static int __msm_wakeup_all_cmdack_session_stream(void *d1, void *d2)
+{
+ struct msm_stream *stream = d1;
+ struct msm_session *session = d2;
+ struct msm_command_ack *cmd_ack = NULL;
+ unsigned long spin_flags = 0;
+
+ cmd_ack = msm_queue_find(&session->command_ack_q,
+ struct msm_command_ack, list,
+ __msm_queue_find_command_ack_q,
+ &stream->stream_id);
+ if (cmd_ack) {
+ spin_lock_irqsave(&(session->command_ack_q.lock),
+ spin_flags);
+ complete(&cmd_ack->wait_complete);
+ spin_unlock_irqrestore(&(session->command_ack_q.lock),
+ spin_flags);
+ }
+ return 0;
+}
+
+static int __msm_close_wakeup_all_cmdack_session(void *d1, void *d2)
+{
+ struct msm_stream *stream = NULL;
+ struct msm_session *session = d1;
+
+ stream = msm_queue_find(&session->stream_q, struct msm_stream,
+ list, __msm_wakeup_all_cmdack_session_stream, d1);
+ return 0;
+}
+
static long msm_private_ioctl(struct file *file, void *fh,
bool valid_prio, unsigned int cmd, void *arg)
{
@@ -882,6 +913,9 @@ static int msm_close(struct file *filep)
msm_queue_traverse_action(msm_session_q, struct msm_session, list,
__msm_close_destry_session_notify_apps, NULL);
+ msm_queue_traverse_action(msm_session_q, struct msm_session, list,
+ __msm_close_wakeup_all_cmdack_session, NULL);
+
spin_lock_irqsave(&msm_eventq_lock, flags);
msm_eventq = NULL;
spin_unlock_irqrestore(&msm_eventq_lock, flags);