summaryrefslogtreecommitdiff
path: root/drivers/media/video/v4l2-ctrls.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2011-06-07 04:50:31 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 17:53:17 -0300
commit7ebbc39fa0b469243b985e5e26755f1e6184213f (patch)
treebdb41825836c777d2e6c7f15572a5e553b68ff83 /drivers/media/video/v4l2-ctrls.c
parent37cd3b73683f15f1b6313d0de476726aa0942a75 (diff)
[media] v4l2-ctrls: drivers should be able to ignore the READ_ONLY flag
When applications try to set READ_ONLY controls an error should be returned. However, when drivers do that it should be accepted. Those controls could reflect some driver status which the application can't change but the driver obviously has to be able to change it. This is needed among others for future HDMI status controls. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-ctrls.c')
-rw-r--r--drivers/media/video/v4l2-ctrls.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index d9e04394c856..0b1b30fded60 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -1826,9 +1826,6 @@ static int set_ctrl(struct v4l2_ctrl *ctrl, s32 *val)
int ret;
int i;
- if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
- return -EACCES;
-
v4l2_ctrl_lock(ctrl);
/* Reset the 'is_new' flags of the cluster */
@@ -1853,6 +1850,9 @@ int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *control)
if (ctrl == NULL || !type_is_int(ctrl))
return -EINVAL;
+ if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
+ return -EACCES;
+
return set_ctrl(ctrl, &control->value);
}
EXPORT_SYMBOL(v4l2_s_ctrl);