Commit 95ad7ff3 authored by Ricardo Ribalda's avatar Ricardo Ribalda Committed by Mauro Carvalho Chehab

[media] v4l2-core/v4l2-ctrls: Filter NOOP CH_RANGE events

If modify_range is called but no range is changed, do not send the
CH_RANGE event.
Reported-by: default avatarDimitrios Katsaros <patcherwork@gmail.com>
Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 0dac45f0
......@@ -3300,7 +3300,8 @@ EXPORT_SYMBOL(v4l2_ctrl_notify);
int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
s64 min, s64 max, u64 step, s64 def)
{
bool changed;
bool value_changed;
bool range_changed = false;
int ret;
lockdep_assert_held(ctrl->handler->lock);
......@@ -3324,10 +3325,14 @@ int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
default:
return -EINVAL;
}
if ((ctrl->minimum != min) || (ctrl->maximum != max) ||
(ctrl->step != step) || ctrl->default_value != def) {
range_changed = true;
ctrl->minimum = min;
ctrl->maximum = max;
ctrl->step = step;
ctrl->default_value = def;
}
cur_to_new(ctrl);
if (validate_new(ctrl, ctrl->p_new)) {
if (ctrl->type == V4L2_CTRL_TYPE_INTEGER64)
......@@ -3337,12 +3342,12 @@ int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
}
if (ctrl->type == V4L2_CTRL_TYPE_INTEGER64)
changed = *ctrl->p_new.p_s64 != *ctrl->p_cur.p_s64;
value_changed = *ctrl->p_new.p_s64 != *ctrl->p_cur.p_s64;
else
changed = *ctrl->p_new.p_s32 != *ctrl->p_cur.p_s32;
if (changed)
value_changed = *ctrl->p_new.p_s32 != *ctrl->p_cur.p_s32;
if (value_changed)
ret = set_ctrl(NULL, ctrl, V4L2_EVENT_CTRL_CH_RANGE);
else
else if (range_changed)
send_event(NULL, ctrl, V4L2_EVENT_CTRL_CH_RANGE);
return ret;
}
......
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