Hi Tomi, On Mon, Feb 07, 2022 at 06:11:00PM +0200, Tomi Valkeinen wrote: > Hi, > > This is v3 of the subdev active state series. Changes since v2: > > - Doc improvements > - Allow state->lock to be set by the driver (similarly to v4l2_ctrl_handler) While I think we need better in the longer term, this seems like a reasonable compromise to land this series and continue building on top. > - Rename fields in 'struct v4l2_subdev_pad_config' and drop the try_ prefix. > - Add v4l2_subdev_get_locked_active_state(), which calls lockdep_assert_locked() and returns the state. > - Changed v4l2_subdev_get_active_state() to call lockdep_assert_not_locked() > > The idea with the v4l2_subdev_get_active_state / > v4l2_subdev_get_locked_active_state change is to have a lockdep_assert > called. Roughly I think there are two cases where the > v4l2_subdev_get_active_state could be called: > > - With the intention of just passing it forward to another subdev, in > which case the state must _not_ be locked. Here > v4l2_subdev_get_active_state() can be called. > > - With the intention of using the state in a case where the state is > known to be already locked. Here v4l2_subdev_get_locked_active_state() > can be called. I'm not sure how this will work out, but it seems fine to me to start with. > The state->lock change hopefully solves Sakari's concerns about the > locking between controls and state. > > Tomi > > Tomi Valkeinen (7): > media: subdev: rename subdev-state alloc & free > media: subdev: add active state to struct v4l2_subdev > media: subdev: pass also the active state to subdevs from ioctls > media: subdev: add subdev state locking > media: subdev: Add v4l2_subdev_lock_and_return_state() > media: Documentation: add documentation about subdev state > media: subdev: rename v4l2_subdev_pad_config.try_* fields > > .../driver-api/media/v4l2-subdev.rst | 60 ++++++ > drivers/media/i2c/adv7183.c | 2 +- > drivers/media/i2c/imx274.c | 12 +- > drivers/media/i2c/mt9m001.c | 2 +- > drivers/media/i2c/mt9m111.c | 2 +- > drivers/media/i2c/mt9t112.c | 2 +- > drivers/media/i2c/mt9v011.c | 2 +- > drivers/media/i2c/mt9v111.c | 4 +- > drivers/media/i2c/ov2640.c | 2 +- > drivers/media/i2c/ov6650.c | 18 +- > drivers/media/i2c/ov772x.c | 2 +- > drivers/media/i2c/ov9640.c | 2 +- > drivers/media/i2c/rj54n1cb0c.c | 2 +- > drivers/media/i2c/saa6752hs.c | 2 +- > drivers/media/i2c/sr030pc30.c | 2 +- > drivers/media/i2c/tw9910.c | 2 +- > drivers/media/i2c/vs6624.c | 2 +- > drivers/media/platform/atmel/atmel-isc-base.c | 8 +- > drivers/media/platform/atmel/atmel-isi.c | 8 +- > drivers/media/platform/rcar-vin/rcar-v4l2.c | 9 +- > drivers/media/platform/vsp1/vsp1_entity.c | 10 +- > drivers/media/v4l2-core/v4l2-subdev.c | 126 +++++++++-- > drivers/staging/media/tegra-video/vi.c | 10 +- > include/media/v4l2-subdev.h | 201 ++++++++++++++++-- > 24 files changed, 415 insertions(+), 77 deletions(-) -- Regards, Laurent Pinchart