diff options
| author | Sakari Ailus <[email protected]> | 2023-09-06 07:56:14 +0000 |
|---|---|---|
| committer | Hans Verkuil <[email protected]> | 2024-04-29 12:56:37 +0000 |
| commit | 72364b91ce022ded4aa541c62f51c10a65fb3498 (patch) | |
| tree | 262064afa3318bf285b45f611c7b73e7c51c4530 /drivers/media/v4l2-core/v4l2-subdev.c | |
| parent | media: Documentation: Document S_ROUTING behaviour (diff) | |
| download | kernel-72364b91ce022ded4aa541c62f51c10a65fb3498.tar.gz kernel-72364b91ce022ded4aa541c62f51c10a65fb3498.zip | |
media: v4l: subdev: Add a function to lock two sub-device states, use it
Add two new functions, v4l2_subdev_lock_states() and
v4l2_subdev_unclock_states(), to acquire and release the state of two
sub-devices. They differ from calling v4l2_subdev_{un,}lock_state() so
that if the two states share the same lock, the lock is acquired only
once.
Also use the new functions in v4l2_subdev_link_validate().
Signed-off-by: Sakari Ailus <[email protected]>
Reviewed-by: Julien Massot <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-subdev.c')
| -rw-r--r-- | drivers/media/v4l2-core/v4l2-subdev.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 2d67ec54569a..779583447eac 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -1437,17 +1437,13 @@ int v4l2_subdev_link_validate(struct media_link *link) states_locked = sink_state && source_state; - if (states_locked) { - v4l2_subdev_lock_state(sink_state); - v4l2_subdev_lock_state(source_state); - } + if (states_locked) + v4l2_subdev_lock_states(sink_state, source_state); ret = v4l2_subdev_link_validate_locked(link, states_locked); - if (states_locked) { - v4l2_subdev_unlock_state(sink_state); - v4l2_subdev_unlock_state(source_state); - } + if (states_locked) + v4l2_subdev_unlock_states(sink_state, source_state); return ret; } |
