summaryrefslogtreecommitdiff
path: root/drivers/media/video/v4l2-ctrls.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-03-02 19:41:25 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-08 18:03:26 +0400
commit072e660257ee26e4f4defd836b1e1fa23d68de32 (patch)
treeffaf659f5b790a870ab216b4c9c077140f966d78 /drivers/media/video/v4l2-ctrls.c
parent99025937bcd2291e6e50b4e54fe1f6d48d4c2b7c (diff)
downloadlinux-072e660257ee26e4f4defd836b1e1fa23d68de32.tar.xz
[media] v4l2-ctrls: v4l2_ctrl_add_handler should add all refs
Currently v4l2_ctrl_add_handler adds only the controls that are owned by the handler. This is wrong. Instead all controls, whether owned or not, should be added. This is also implied by the v4l2-controls.txt documentation and it is clearly the right thing to do. The only reason this was never noticed before is because we never did this. Only recent changes in ivtv made this error visible because there a third handler layer was added (handler A inherits from handler B which inherits from C, D and E). Without this change handler A only sees the controls owned by handler B and the controls from C, D and E are missing. 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, 4 insertions, 2 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index e6c7c8e8cc4e..88cb2c6e5d23 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -1517,7 +1517,7 @@ EXPORT_SYMBOL(v4l2_ctrl_add_ctrl);
int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
struct v4l2_ctrl_handler *add)
{
- struct v4l2_ctrl *ctrl;
+ struct v4l2_ctrl_ref *ref;
int ret = 0;
/* Do nothing if either handler is NULL or if they are the same */
@@ -1526,7 +1526,9 @@ int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
if (hdl->error)
return hdl->error;
mutex_lock(&add->lock);
- list_for_each_entry(ctrl, &add->ctrls, node) {
+ list_for_each_entry(ref, &add->ctrl_refs, node) {
+ struct v4l2_ctrl *ctrl = ref->ctrl;
+
/* Skip handler-private controls. */
if (ctrl->is_private)
continue;