2019年1月24日(木) 0:17 Marco Felsch <m.fel...@pengutronix.de>:
>
> Hi Akinobu,
>
> sorry for the delayed response.
>
> On 19-01-15 23:05, Akinobu Mita wrote:
> > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize
> > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE
> > is specified.
> >
> > Cc: Enrico Scholz <enrico.sch...@sigma-chemnitz.de>
> > Cc: Michael Grzeschik <m.grzesc...@pengutronix.de>
> > Cc: Marco Felsch <m.fel...@pengutronix.de>
> > Cc: Sakari Ailus <sakari.ai...@linux.intel.com>
> > Cc: Mauro Carvalho Chehab <mche...@kernel.org>
> > Signed-off-by: Akinobu Mita <akinobu.m...@gmail.com>
> > ---
> > * v3
> > - Set initial try format with default configuration instead of
> >   current one.
> >
> >  drivers/media/i2c/mt9m111.c | 30 ++++++++++++++++++++++++++++++
> >  1 file changed, 30 insertions(+)
> >
> > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
> > index d639b9b..63a5253 100644
> > --- a/drivers/media/i2c/mt9m111.c
> > +++ b/drivers/media/i2c/mt9m111.c
> > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd,
> >       if (format->pad)
> >               return -EINVAL;
> >
> > +     if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
> > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
> > +             mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
> > +             format->format = *mf;
> > +             return 0;
> > +#else
> > +             return -ENOTTY;
> > +#endif
>
> If've checked this again and found the ov* devices do this too. IMO it's
> not good for other developers to check the upper layer if the '#else'
> path is reachable. There are also some code analyzer tools which will
> report this as issue/warning.
>
> As I said, I checked the v4l2_subdev_get_try_format() usage again and
> found the solution made by the mt9v111.c better. Why do you don't add a
> dependency in the Kconfig, so we can drop this ifdef?

I'm ok with adding CONFIG_VIDEO_V4L2_SUBDEV_API dependency to this
driver, because I always enable it.

But it may cause an issue on some environments that don't require
CONFIG_VIDEO_V4L2_SUBDEV_API.

Sakari, do you have any opinion?

Reply via email to