The m5mols_capture_post_work() is collecting works after capture. The order 
should
be kept, and it's safe to say success of capture when all this conditions are 
fine.

Signed-off-by: HeungJun, Kim <riverful....@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.p...@samsung.com>
---
 drivers/media/video/m5mols/m5mols_capture.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/m5mols/m5mols_capture.c 
b/drivers/media/video/m5mols/m5mols_capture.c
index 751f459..8436105 100644
--- a/drivers/media/video/m5mols/m5mols_capture.c
+++ b/drivers/media/video/m5mols/m5mols_capture.c
@@ -31,22 +31,29 @@
 #include "m5mols.h"
 #include "m5mols_reg.h"
 
-static int m5mols_capture_error_handler(struct m5mols_info *info,
-                                       int timeout)
+/**
+ * m5mols_capture_post_work - Handle post work after capture interrupt occur
+ *
+ * Return 0 if all condition associated with capture is fine.
+ */
+static int m5mols_capture_post_work(struct m5mols_info *info, int timeout)
 {
        int ret;
 
-       /* Disable all interrupts and clear relevant interrupt staus bits */
+       /* First, disable capture interrupt */
        ret = m5mols_write(&info->sd, SYSTEM_INT_ENABLE,
                           info->interrupt & ~(REG_INT_CAPTURE));
        if (ret)
                return ret;
 
+       /* Then, if timeout is exhasted, return ETIMEDOUT */
        if (timeout == 0)
                return -ETIMEDOUT;
 
+       /* All condition is satisfied, return 0 */
        return 0;
 }
+
 /**
  * m5mols_read_rational - I2C read of a rational number
  *
@@ -150,7 +157,7 @@ int m5mols_start_capture(struct m5mols_info *info)
                                           test_bit(ST_CAPT_IRQ, &info->flags),
                                           msecs_to_jiffies(2000));
                if (test_and_clear_bit(ST_CAPT_IRQ, &info->flags))
-                       ret = m5mols_capture_error_handler(info, timeout);
+                       ret = m5mols_capture_post_work(info, timeout);
        }
        if (!ret)
                ret = m5mols_lock_3a(info, false);
@@ -187,5 +194,5 @@ int m5mols_start_capture(struct m5mols_info *info)
                }
        }
 
-       return m5mols_capture_error_handler(info, timeout);
+       return m5mols_capture_post_work(info, timeout);
 }
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to