if (ctrl == NULL)
return;
- changed = !ctrl->type_ops->equal(ctrl, ctrl->p_cur, ctrl->p_new);
- ptr_to_ptr(ctrl, ctrl->p_new, ctrl->p_cur);
+
+ /* has_changed is set by cluster_changed */
+ changed = ctrl->has_changed;
+ if (changed)
+ ptr_to_ptr(ctrl, ctrl->p_new, ctrl->p_cur);
if (ch_flags & V4L2_EVENT_CTRL_CH_FLAGS) {
/* Note: CH_FLAGS is only set for auto clusters. */
value that differs from the current value. */
static int cluster_changed(struct v4l2_ctrl *master)
{
- int diff = 0;
+ bool changed = false;
int i;
- for (i = 0; !diff && i < master->ncontrols; i++) {
+ for (i = 0; i < master->ncontrols; i++) {
struct v4l2_ctrl *ctrl = master->cluster[i];
if (ctrl == NULL)
continue;
- diff = !ctrl->type_ops->equal(ctrl, ctrl->p_cur, ctrl->p_new);
+ ctrl->has_changed = !ctrl->type_ops->equal(ctrl,
+ ctrl->p_cur, ctrl->p_new);
+ changed |= ctrl->has_changed;
}
- return diff;
+ return changed;
}
/* Control range checking */
* @is_new: Set when the user specified a new value for this control. It
* is also set when called from v4l2_ctrl_handler_setup. Drivers
* should never set this flag.
+ * @has_changed: Set when the current value differs from the new value. Drivers
+ * should never use this flag.
* @is_private: If set, then this control is private to its handler and it
* will not be added to any other handlers. Drivers can set
* this flag.
unsigned int done:1;
unsigned int is_new:1;
+ unsigned int has_changed:1;
unsigned int is_private:1;
unsigned int is_auto:1;
unsigned int is_int:1;