aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-ctrls.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2011-08-26 06:35:14 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-09-21 08:52:21 -0400
commit88365105d683187e02a4f75220eaf51fd0c0b6e0 (patch)
treeacbc18b9e8eb7f74630fb7fd709cb35eafd30f54 /drivers/media/video/v4l2-ctrls.c
parent74a45790861f659058e8f8b565d98e5a1fdd8440 (diff)
[media] v4l2-ctrls: replace is_volatile with V4L2_CTRL_FLAG_VOLATILE
With the new flag there is no need anymore to have a separate is_volatile field. Modify all users to use the new flag. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-ctrls.c')
-rw-r--r--drivers/media/video/v4l2-ctrls.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 06b6014d4fb4..166762182f8e 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -43,7 +43,7 @@ struct v4l2_ctrl_helper {
43}; 43};
44 44
45/* Small helper function to determine if the autocluster is set to manual 45/* Small helper function to determine if the autocluster is set to manual
46 mode. In that case the is_volatile flag should be ignored. */ 46 mode. */
47static bool is_cur_manual(const struct v4l2_ctrl *master) 47static bool is_cur_manual(const struct v4l2_ctrl *master)
48{ 48{
49 return master->is_auto && master->cur.val == master->manual_mode_value; 49 return master->is_auto && master->cur.val == master->manual_mode_value;
@@ -1394,10 +1394,8 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
1394 type, min, max, 1394 type, min, max,
1395 is_menu ? cfg->menu_skip_mask : step, 1395 is_menu ? cfg->menu_skip_mask : step,
1396 def, flags, qmenu, priv); 1396 def, flags, qmenu, priv);
1397 if (ctrl) { 1397 if (ctrl)
1398 ctrl->is_private = cfg->is_private; 1398 ctrl->is_private = cfg->is_private;
1399 ctrl->is_volatile = cfg->is_volatile;
1400 }
1401 return ctrl; 1399 return ctrl;
1402} 1400}
1403EXPORT_SYMBOL(v4l2_ctrl_new_custom); 1401EXPORT_SYMBOL(v4l2_ctrl_new_custom);
@@ -1519,12 +1517,12 @@ void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,
1519 master->manual_mode_value = manual_val; 1517 master->manual_mode_value = manual_val;
1520 master->flags |= V4L2_CTRL_FLAG_UPDATE; 1518 master->flags |= V4L2_CTRL_FLAG_UPDATE;
1521 flag = is_cur_manual(master) ? 0 : V4L2_CTRL_FLAG_INACTIVE; 1519 flag = is_cur_manual(master) ? 0 : V4L2_CTRL_FLAG_INACTIVE;
1520 if (set_volatile)
1521 flag |= V4L2_CTRL_FLAG_VOLATILE;
1522 1522
1523 for (i = 1; i < ncontrols; i++) 1523 for (i = 1; i < ncontrols; i++)
1524 if (controls[i]) { 1524 if (controls[i])
1525 controls[i]->is_volatile = set_volatile;
1526 controls[i]->flags |= flag; 1525 controls[i]->flags |= flag;
1527 }
1528} 1526}
1529EXPORT_SYMBOL(v4l2_ctrl_auto_cluster); 1527EXPORT_SYMBOL(v4l2_ctrl_auto_cluster);
1530 1528
@@ -1579,9 +1577,6 @@ EXPORT_SYMBOL(v4l2_ctrl_grab);
1579static void log_ctrl(const struct v4l2_ctrl *ctrl, 1577static void log_ctrl(const struct v4l2_ctrl *ctrl,
1580 const char *prefix, const char *colon) 1578 const char *prefix, const char *colon)
1581{ 1579{
1582 int fl_inact = ctrl->flags & V4L2_CTRL_FLAG_INACTIVE;
1583 int fl_grabbed = ctrl->flags & V4L2_CTRL_FLAG_GRABBED;
1584
1585 if (ctrl->flags & (V4L2_CTRL_FLAG_DISABLED | V4L2_CTRL_FLAG_WRITE_ONLY)) 1580 if (ctrl->flags & (V4L2_CTRL_FLAG_DISABLED | V4L2_CTRL_FLAG_WRITE_ONLY))
1586 return; 1581 return;
1587 if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS) 1582 if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS)
@@ -1612,14 +1607,17 @@ static void log_ctrl(const struct v4l2_ctrl *ctrl,
1612 printk(KERN_CONT "unknown type %d", ctrl->type); 1607 printk(KERN_CONT "unknown type %d", ctrl->type);
1613 break; 1608 break;
1614 } 1609 }
1615 if (fl_inact && fl_grabbed) 1610 if (ctrl->flags & (V4L2_CTRL_FLAG_INACTIVE |
1616 printk(KERN_CONT " (inactive, grabbed)\n"); 1611 V4L2_CTRL_FLAG_GRABBED |
1617 else if (fl_inact) 1612 V4L2_CTRL_FLAG_VOLATILE)) {
1618 printk(KERN_CONT " (inactive)\n"); 1613 if (ctrl->flags & V4L2_CTRL_FLAG_INACTIVE)
1619 else if (fl_grabbed) 1614 printk(KERN_CONT " inactive");
1620 printk(KERN_CONT " (grabbed)\n"); 1615 if (ctrl->flags & V4L2_CTRL_FLAG_GRABBED)
1621 else 1616 printk(KERN_CONT " grabbed");
1622 printk(KERN_CONT "\n"); 1617 if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE)
1618 printk(KERN_CONT " volatile");
1619 }
1620 printk(KERN_CONT "\n");
1623} 1621}
1624 1622
1625/* Log all controls owned by the handler */ 1623/* Log all controls owned by the handler */
@@ -2004,7 +2002,7 @@ static int get_ctrl(struct v4l2_ctrl *ctrl, s32 *val)
2004 2002
2005 v4l2_ctrl_lock(master); 2003 v4l2_ctrl_lock(master);
2006 /* g_volatile_ctrl will update the current control values */ 2004 /* g_volatile_ctrl will update the current control values */
2007 if (ctrl->is_volatile && !is_cur_manual(master)) { 2005 if ((ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) && !is_cur_manual(master)) {
2008 for (i = 0; i < master->ncontrols; i++) 2006 for (i = 0; i < master->ncontrols; i++)
2009 cur_to_new(master->cluster[i]); 2007 cur_to_new(master->cluster[i]);
2010 ret = call_op(master, g_volatile_ctrl); 2008 ret = call_op(master, g_volatile_ctrl);