aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/v4l2-core/v4l2-ctrls.c17
-rw-r--r--include/media/v4l2-ctrls.h3
2 files changed, 14 insertions, 6 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index e7e0beab7048..1b4d37ce4afe 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1424,8 +1424,11 @@ static void new_to_cur(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 ch_flags)
1424 1424
1425 if (ctrl == NULL) 1425 if (ctrl == NULL)
1426 return; 1426 return;
1427 changed = !ctrl->type_ops->equal(ctrl, ctrl->p_cur, ctrl->p_new); 1427
1428 ptr_to_ptr(ctrl, ctrl->p_new, ctrl->p_cur); 1428 /* has_changed is set by cluster_changed */
1429 changed = ctrl->has_changed;
1430 if (changed)
1431 ptr_to_ptr(ctrl, ctrl->p_new, ctrl->p_cur);
1429 1432
1430 if (ch_flags & V4L2_EVENT_CTRL_CH_FLAGS) { 1433 if (ch_flags & V4L2_EVENT_CTRL_CH_FLAGS) {
1431 /* Note: CH_FLAGS is only set for auto clusters. */ 1434 /* Note: CH_FLAGS is only set for auto clusters. */
@@ -1462,17 +1465,19 @@ static void cur_to_new(struct v4l2_ctrl *ctrl)
1462 value that differs from the current value. */ 1465 value that differs from the current value. */
1463static int cluster_changed(struct v4l2_ctrl *master) 1466static int cluster_changed(struct v4l2_ctrl *master)
1464{ 1467{
1465 int diff = 0; 1468 bool changed = false;
1466 int i; 1469 int i;
1467 1470
1468 for (i = 0; !diff && i < master->ncontrols; i++) { 1471 for (i = 0; i < master->ncontrols; i++) {
1469 struct v4l2_ctrl *ctrl = master->cluster[i]; 1472 struct v4l2_ctrl *ctrl = master->cluster[i];
1470 1473
1471 if (ctrl == NULL) 1474 if (ctrl == NULL)
1472 continue; 1475 continue;
1473 diff = !ctrl->type_ops->equal(ctrl, ctrl->p_cur, ctrl->p_new); 1476 ctrl->has_changed = !ctrl->type_ops->equal(ctrl,
1477 ctrl->p_cur, ctrl->p_new);
1478 changed |= ctrl->has_changed;
1474 } 1479 }
1475 return diff; 1480 return changed;
1476} 1481}
1477 1482
1478/* Control range checking */ 1483/* Control range checking */
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index ddd9fdf1ac1a..a38bd55909b2 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -96,6 +96,8 @@ typedef void (*v4l2_ctrl_notify_fnc)(struct v4l2_ctrl *ctrl, void *priv);
96 * @is_new: Set when the user specified a new value for this control. It 96 * @is_new: Set when the user specified a new value for this control. It
97 * is also set when called from v4l2_ctrl_handler_setup. Drivers 97 * is also set when called from v4l2_ctrl_handler_setup. Drivers
98 * should never set this flag. 98 * should never set this flag.
99 * @has_changed: Set when the current value differs from the new value. Drivers
100 * should never use this flag.
99 * @is_private: If set, then this control is private to its handler and it 101 * @is_private: If set, then this control is private to its handler and it
100 * will not be added to any other handlers. Drivers can set 102 * will not be added to any other handlers. Drivers can set
101 * this flag. 103 * this flag.
@@ -158,6 +160,7 @@ struct v4l2_ctrl {
158 unsigned int done:1; 160 unsigned int done:1;
159 161
160 unsigned int is_new:1; 162 unsigned int is_new:1;
163 unsigned int has_changed:1;
161 unsigned int is_private:1; 164 unsigned int is_private:1;
162 unsigned int is_auto:1; 165 unsigned int is_auto:1;
163 unsigned int is_int:1; 166 unsigned int is_int:1;