aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2024-01-17 15:52:04 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2024-02-05 12:57:44 +0100
commit9801b5b28c6929139d6fceeee8d739cc67bb2739 (patch)
treef1013e4b9d405a144f4f96ae142e12f20198014e /drivers/media
parent8674fd635f287a0652ae1459f6ebb15bc82c2707 (diff)
downloadlinux-9801b5b28c6929139d6fceeee8d739cc67bb2739.tar.gz
media: v4l2-ctrls: show all owned controls in log_status
VIDIOC_LOG_STATUS will log the controls owned by the driver. But the code didn't take into account the case where a single driver creates multiple control handlers. A good example is the vivid driver, but others use it as well. Modify v4l2_ctrl_handler_log_status() so that it really shows all controls owned by this driver. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/v4l2-core/v4l2-ctrls-core.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
index a662fb60f73f42..0accb96001db07 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
@@ -2503,7 +2503,8 @@ int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl)
EXPORT_SYMBOL(v4l2_ctrl_handler_setup);
/* Log the control name and value */
-static void log_ctrl(const struct v4l2_ctrl *ctrl,
+static void log_ctrl(const struct v4l2_ctrl_handler *hdl,
+ struct v4l2_ctrl *ctrl,
const char *prefix, const char *colon)
{
if (ctrl->flags & (V4L2_CTRL_FLAG_DISABLED | V4L2_CTRL_FLAG_WRITE_ONLY))
@@ -2513,7 +2514,11 @@ static void log_ctrl(const struct v4l2_ctrl *ctrl,
pr_info("%s%s%s: ", prefix, colon, ctrl->name);
+ if (ctrl->handler != hdl)
+ v4l2_ctrl_lock(ctrl);
ctrl->type_ops->log(ctrl);
+ if (ctrl->handler != hdl)
+ v4l2_ctrl_unlock(ctrl);
if (ctrl->flags & (V4L2_CTRL_FLAG_INACTIVE |
V4L2_CTRL_FLAG_GRABBED |
@@ -2532,7 +2537,7 @@ static void log_ctrl(const struct v4l2_ctrl *ctrl,
void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
const char *prefix)
{
- struct v4l2_ctrl *ctrl;
+ struct v4l2_ctrl_ref *ref;
const char *colon = "";
int len;
@@ -2544,9 +2549,12 @@ void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl,
if (len && prefix[len - 1] != ' ')
colon = ": ";
mutex_lock(hdl->lock);
- list_for_each_entry(ctrl, &hdl->ctrls, node)
- if (!(ctrl->flags & V4L2_CTRL_FLAG_DISABLED))
- log_ctrl(ctrl, prefix, colon);
+ list_for_each_entry(ref, &hdl->ctrl_refs, node) {
+ if (ref->from_other_dev ||
+ (ref->ctrl->flags & V4L2_CTRL_FLAG_DISABLED))
+ continue;
+ log_ctrl(hdl, ref->ctrl, prefix, colon);
+ }
mutex_unlock(hdl->lock);
}
EXPORT_SYMBOL(v4l2_ctrl_handler_log_status);