From: Sakari Ailus <sakari.ai...@linux.intel.com>

Instead of returning -EBUSY in s_ctrl(), use __v4l2_ctrl_grab() to mark the
controls grabbed.

Signed-off-by: Sakari Ailus <sakari.ai...@linux.intel.com>
---
 drivers/media/i2c/smiapp/smiapp-core.c |   20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index e534f1b..6658f61 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -423,9 +423,6 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
 
        case V4L2_CID_HFLIP:
        case V4L2_CID_VFLIP:
-               if (sensor->streaming)
-                       return -EBUSY;
-
                if (sensor->hflip->val)
                        orient |= SMIAPP_IMAGE_ORIENTATION_HFLIP;
 
@@ -469,9 +466,6 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
                        + ctrl->val);
 
        case V4L2_CID_LINK_FREQ:
-               if (sensor->streaming)
-                       return -EBUSY;
-
                return smiapp_pll_update(sensor);
 
        case V4L2_CID_TEST_PATTERN: {
@@ -1535,15 +1529,15 @@ static int smiapp_set_stream(struct v4l2_subdev 
*subdev, int enable)
        if (sensor->streaming == enable)
                goto out;
 
-       if (enable) {
-               sensor->streaming = true;
+       if (enable)
                rval = smiapp_start_streaming(sensor);
-               if (rval < 0)
-                       sensor->streaming = false;
-       } else {
+       else
                rval = smiapp_stop_streaming(sensor);
-               sensor->streaming = false;
-       }
+
+       sensor->streaming = enable;
+       __v4l2_ctrl_grab(sensor->hflip, enable);
+       __v4l2_ctrl_grab(sensor->vflip, enable);
+       __v4l2_ctrl_grab(sensor->link_freq, enable);
 
 out:
        mutex_unlock(&sensor->mutex);
-- 
1.7.10.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