Skip to content

Commit

Permalink
[media] v4l2-ctrls: v4l2_ctrl_add_handler should add all refs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 8, 2012
1 parent 9902593 commit 072e660
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/media/video/v4l2-ctrls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
Expand Down

0 comments on commit 072e660

Please sign in to comment.