diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2014-06-12 12:09:40 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-21 18:44:45 -0400 |
commit | 5a573925159aeec1dd159627d849dc6c66000faf (patch) | |
tree | 6464a008eeca716c199dc10c8a23a67d2fb3ecca /include/media | |
parent | 605b38403b710ca01a242448241bc45c722b341b (diff) |
[media] v4l: ctrls: Provide an unlocked variant of v4l2_ctrl_modify_range()
Drivers may use the v4l2_ctrl_modify_range() internally as part of other
operations that need to be both serialised using a driver's lock which can
also be used to serialise access to the control handler. Provide an unlocked
version of the function, __v4l2_ctrl_modify_range() which then may be used
by drivers for the purpose.
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 'include/media')
-rw-r--r-- | include/media/v4l2-ctrls.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 4546233a9a3d..5d1a30ca29af 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -620,6 +620,11 @@ void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); | |||
620 | */ | 620 | */ |
621 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); | 621 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); |
622 | 622 | ||
623 | |||
624 | /** __v4l2_ctrl_modify_range() - Unlocked variant of v4l2_ctrl_modify_range() */ | ||
625 | int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, | ||
626 | s64 min, s64 max, u64 step, s64 def); | ||
627 | |||
623 | /** v4l2_ctrl_modify_range() - Update the range of a control. | 628 | /** v4l2_ctrl_modify_range() - Update the range of a control. |
624 | * @ctrl: The control to update. | 629 | * @ctrl: The control to update. |
625 | * @min: The control's minimum value. | 630 | * @min: The control's minimum value. |
@@ -637,8 +642,17 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); | |||
637 | * This function assumes that the control handler is not locked and will | 642 | * This function assumes that the control handler is not locked and will |
638 | * take the lock itself. | 643 | * take the lock itself. |
639 | */ | 644 | */ |
640 | int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, | 645 | static inline int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, |
641 | s64 min, s64 max, u64 step, s64 def); | 646 | s64 min, s64 max, u64 step, s64 def) |
647 | { | ||
648 | int rval; | ||
649 | |||
650 | v4l2_ctrl_lock(ctrl); | ||
651 | rval = __v4l2_ctrl_modify_range(ctrl, min, max, step, def); | ||
652 | v4l2_ctrl_unlock(ctrl); | ||
653 | |||
654 | return rval; | ||
655 | } | ||
642 | 656 | ||
643 | /** v4l2_ctrl_notify() - Function to set a notify callback for a control. | 657 | /** v4l2_ctrl_notify() - Function to set a notify callback for a control. |
644 | * @ctrl: The control. | 658 | * @ctrl: The control. |