One more comment... On Mon, May 20, 2019 at 10:18:12PM +0200, Marek Vasut wrote: ... > +static int isl7998x_set_fmt(struct v4l2_subdev *sd, > + struct v4l2_subdev_pad_config *cfg, > + struct v4l2_subdev_format *format) > +{ > + struct isl7998x *isl7998x = sd_to_isl7998x(sd); > + struct v4l2_mbus_framefmt *mf = &format->format; > + int ret; > + > + if (format->pad != 0) > + return -EINVAL; > + > + if (format->format.width != 720 || > + (format->format.height != 480 && format->format.height != 576)) > + return -EINVAL; > + > + if (format->format.code != MEDIA_BUS_FMT_YUYV8_2X8) > + return -EINVAL; > + > + mf->width = format->format.width; > + mf->height = format->format.height; > + mf->code = format->format.code; > + mf->field = V4L2_FIELD_INTERLACED; > + mf->colorspace = 0; > + > + if (format->which != V4L2_SUBDEV_FORMAT_TRY) { > + ret = isl7998x_update_std(isl7998x); > + if (ret) > + return ret; > + mf->width = isl7998x->width; > + mf->height = isl7998x->height; > + isl7998x->fmt = &isl7998x_colour_fmts[0]; > + } Note that as the driver exposes a sub-device node to the user space, it's responsible for serialising the access to its own data structures that are accessed by other drivers or through its uAPI nodes. Most drivers use the same mutex as the control handler, as controls usually deal with at least some of the same data. -- Regards, Sakari Ailus sakari.ailus@xxxxxxxxxxxxxxx