diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2012-01-24 19:05:34 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-14 07:46:27 -0400 |
commit | 77e7c4e624404c6edb5686b3d5f873c6008ed6b0 (patch) | |
tree | 1ba1d9903bb8eca6e3ca3439d3a5981274ea86ba /include/media | |
parent | 8227c92b69688403dee2adf5f399a49539ae5049 (diff) |
[media] v4l: Allow changing control handler lock
Allow choosing the lock used by the control handler. This may be handy
sometimes when a driver providing multiple subdevs does not want to use
several locks to serialise its functions.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/v4l2-ctrls.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index c6f6b4c2c5f2..dde6fbacc271 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -167,7 +167,9 @@ struct v4l2_ctrl_ref { | |||
167 | /** struct v4l2_ctrl_handler - The control handler keeps track of all the | 167 | /** struct v4l2_ctrl_handler - The control handler keeps track of all the |
168 | * controls: both the controls owned by the handler and those inherited | 168 | * controls: both the controls owned by the handler and those inherited |
169 | * from other handlers. | 169 | * from other handlers. |
170 | * @_lock: Default for "lock". | ||
170 | * @lock: Lock to control access to this handler and its controls. | 171 | * @lock: Lock to control access to this handler and its controls. |
172 | * May be replaced by the user right after init. | ||
171 | * @ctrls: The list of controls owned by this handler. | 173 | * @ctrls: The list of controls owned by this handler. |
172 | * @ctrl_refs: The list of control references. | 174 | * @ctrl_refs: The list of control references. |
173 | * @cached: The last found control reference. It is common that the same | 175 | * @cached: The last found control reference. It is common that the same |
@@ -178,7 +180,8 @@ struct v4l2_ctrl_ref { | |||
178 | * @error: The error code of the first failed control addition. | 180 | * @error: The error code of the first failed control addition. |
179 | */ | 181 | */ |
180 | struct v4l2_ctrl_handler { | 182 | struct v4l2_ctrl_handler { |
181 | struct mutex lock; | 183 | struct mutex _lock; |
184 | struct mutex *lock; | ||
182 | struct list_head ctrls; | 185 | struct list_head ctrls; |
183 | struct list_head ctrl_refs; | 186 | struct list_head ctrl_refs; |
184 | struct v4l2_ctrl_ref *cached; | 187 | struct v4l2_ctrl_ref *cached; |
@@ -455,7 +458,7 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); | |||
455 | */ | 458 | */ |
456 | static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl) | 459 | static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl) |
457 | { | 460 | { |
458 | mutex_lock(&ctrl->handler->lock); | 461 | mutex_lock(ctrl->handler->lock); |
459 | } | 462 | } |
460 | 463 | ||
461 | /** v4l2_ctrl_lock() - Helper function to unlock the handler | 464 | /** v4l2_ctrl_lock() - Helper function to unlock the handler |
@@ -464,7 +467,7 @@ static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl) | |||
464 | */ | 467 | */ |
465 | static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl) | 468 | static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl) |
466 | { | 469 | { |
467 | mutex_unlock(&ctrl->handler->lock); | 470 | mutex_unlock(ctrl->handler->lock); |
468 | } | 471 | } |
469 | 472 | ||
470 | /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver. | 473 | /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver. |