Commit 7ebbc39f authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 37cd3b73
...@@ -1826,9 +1826,6 @@ static int set_ctrl(struct v4l2_ctrl *ctrl, s32 *val) ...@@ -1826,9 +1826,6 @@ static int set_ctrl(struct v4l2_ctrl *ctrl, s32 *val)
int ret; int ret;
int i; int i;
if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
return -EACCES;
v4l2_ctrl_lock(ctrl); v4l2_ctrl_lock(ctrl);
/* Reset the 'is_new' flags of the cluster */ /* 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) ...@@ -1853,6 +1850,9 @@ int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *control)
if (ctrl == NULL || !type_is_int(ctrl)) if (ctrl == NULL || !type_is_int(ctrl))
return -EINVAL; return -EINVAL;
if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
return -EACCES;
return set_ctrl(ctrl, &control->value); return set_ctrl(ctrl, &control->value);
} }
EXPORT_SYMBOL(v4l2_s_ctrl); EXPORT_SYMBOL(v4l2_s_ctrl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment