summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2014-06-12 20:09:42 +0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-22 03:10:48 +0400
commit0c4348ada001181637b8f73482242166ba2fb56e (patch)
tree819c95c0cc6a31fea3730f3c9254d04cc1cb2c6a /drivers/media
parent5a573925159aeec1dd159627d849dc6c66000faf (diff)
downloadlinux-0c4348ada001181637b8f73482242166ba2fb56e.tar.xz
[media] v4l: ctrls: Unlocked variants of v4l2_ctrl_s_ctrl{,_int64}()
Implement unlocked variants of v4l2_ctrl_s_ctrl() and v4l2_ctrl_s_ctrl_int64(). As drivers need to set controls as they access driver internal state elsewhere than in the control framework unlocked variants of these functions become handy. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/v4l2-core/v4l2-ctrls.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 9cd978334b89..1acc7aa9d7e2 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -3175,27 +3175,41 @@ int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *control)
}
EXPORT_SYMBOL(v4l2_subdev_s_ctrl);
-int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
+int __v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val)
{
struct v4l2_ext_control c;
+ int rval;
+
+ lockdep_assert_held(ctrl->handler->lock);
/* It's a driver bug if this happens. */
WARN_ON(!ctrl->is_int);
c.value = val;
- return set_ctrl_lock(NULL, ctrl, &c);
+ rval = set_ctrl(NULL, ctrl, &c, 0);
+ if (!rval)
+ cur_to_user(&c, ctrl);
+
+ return rval;
}
-EXPORT_SYMBOL(v4l2_ctrl_s_ctrl);
+EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl);
-int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
+int __v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val)
{
struct v4l2_ext_control c;
+ int rval;
+
+ lockdep_assert_held(ctrl->handler->lock);
/* It's a driver bug if this happens. */
WARN_ON(ctrl->is_ptr || ctrl->type != V4L2_CTRL_TYPE_INTEGER64);
c.value64 = val;
- return set_ctrl_lock(NULL, ctrl, &c);
+ rval = set_ctrl(NULL, ctrl, &c, 0);
+ if (!rval)
+ cur_to_user(&c, ctrl);
+
+ return rval;
}
-EXPORT_SYMBOL(v4l2_ctrl_s_ctrl_int64);
+EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_int64);
void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void *priv)
{