diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2017-05-26 11:21:37 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-06-07 14:38:12 +0300 |
commit | cc0140e2a04513ccdd950d939729e557d23cc910 (patch) | |
tree | 5425f756de737c8d5e597873a783bc2403dd1667 /drivers/media/v4l2-core/v4l2-ctrls.c | |
parent | ec62c9a54cc28dd20dfb08b4663d021028b1a97e (diff) | |
download | linux-cc0140e2a04513ccdd950d939729e557d23cc910.tar.xz |
[media] v4l2-ctrls.c: Implement unlocked variant of v4l2_ctrl_handler_setup()
Sometimes the caller is already holding the control handler mutex and
using it to serialise something. Provide an unlocked variant of the same
function to be used in those cases.
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 <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-ctrls.c')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ctrls.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index ec42872d11cf..dec55d53d24a 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -2444,14 +2444,16 @@ int v4l2_ctrl_subdev_log_status(struct v4l2_subdev *sd) EXPORT_SYMBOL(v4l2_ctrl_subdev_log_status); /* Call s_ctrl for all controls owned by the handler */ -int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl) +int __v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl) { struct v4l2_ctrl *ctrl; int ret = 0; if (hdl == NULL) return 0; - mutex_lock(hdl->lock); + + lockdep_assert_held(hdl->lock); + list_for_each_entry(ctrl, &hdl->ctrls, node) ctrl->done = false; @@ -2476,7 +2478,22 @@ int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl) if (ret) break; } + + return ret; +} +EXPORT_SYMBOL_GPL(__v4l2_ctrl_handler_setup); + +int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl) +{ + int ret; + + if (hdl == NULL) + return 0; + + mutex_lock(hdl->lock); + ret = __v4l2_ctrl_handler_setup(hdl); mutex_unlock(hdl->lock); + return ret; } EXPORT_SYMBOL(v4l2_ctrl_handler_setup); |