Hi Bingbu, On Wed, Apr 12, 2023 at 07:40:19PM +0800, Bingbu Cao wrote: > >> +static int ov01a10_set_format(struct v4l2_subdev *sd, > >> + struct v4l2_subdev_state *sd_state, > >> + struct v4l2_subdev_format *fmt) > >> +{ > >> + struct ov01a10 *ov01a10 = to_ov01a10(sd); > >> + const struct ov01a10_mode *mode; > >> + s32 vblank_def, h_blank; > >> + > >> + mode = v4l2_find_nearest_size(supported_modes, > >> + ARRAY_SIZE(supported_modes), width, > >> + height, fmt->format.width, > >> + fmt->format.height); > >> + > >> + mutex_lock(&ov01a10->mutex); > >> + ov01a10_update_pad_format(mode, &fmt->format); > > > > Could you switch to the sub-device state? That is now the preferred way to > > serialise access to e.g. the format. > > > > See e.g. > > <URL:https://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git/tree/drivers/media/i2c/ov1063x.c?h=streams/work-v16>. > > > > The control handler's mutex doubles as a sub-device state mutex. > > Is it fine to use v4l2_subdev_get_fmt()? Or will it be deprecated soon? Sure, it's fine to use it. -- Sakari Ailus