lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 6 Nov 2023 18:58:51 +0100
From:   Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To:     Mehdi Djait <mehdi.djait@...tlin.com>
Cc:     mchehab@...nel.org, hverkuil-cisco@...all.nl,
        krzysztof.kozlowski+dt@...aro.org, robh+dt@...nel.org,
        conor+dt@...nel.org, laurent.pinchart@...asonboard.com,
        linux-media@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com,
        alexandre.belloni@...tlin.com, maxime.chevallier@...tlin.com
Subject: Re: [PATCH v7 3/3] media: i2c: Introduce a driver for the Techwell
 TW9900 decoder

Hi,

On Mon 06 Nov 23, 16:49, Mehdi Djait wrote:
> Hi Paul,
> 
> On Mon, Nov 06, 2023 at 04:25:18PM +0100, Paul Kocialkowski wrote:
> > > > > +static void tw9900_fill_fmt(const struct tw9900_mode *mode,
> > > > > +			    struct v4l2_mbus_framefmt *fmt)
> > > > > +{
> > > > > +	fmt->code = MEDIA_BUS_FMT_UYVY8_2X8;
> > > > > +	fmt->width = mode->width;
> > > > > +	fmt->height = mode->height;
> > > > > +	fmt->field = V4L2_FIELD_NONE;
> > > > > +	fmt->quantization = V4L2_QUANTIZATION_DEFAULT;
> > > > > +	fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
> > > > > +	fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(V4L2_COLORSPACE_SMPTE170M);
> > > > > +	fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(V4L2_COLORSPACE_SMPTE170M);
> > > > > +}
> > > > > +
> > > > > +static int tw9900_cfg_fmt(struct v4l2_subdev *sd,
> > > > 
> > > > You might have to differentiate between set_fmt/get_fmt to return -EBUSY
> > > > if streaming is on in set_fmt. However I understand it will just copy the
> > > > current mode in both cases, but this might still be required to follow v4l2
> > > > semantics (please double-check).
> > > > 
> > > 
> > > This should be done in the driver calling the pad subdev_call set_fmt,
> > > right ?
> > 
> > Well the two things are distinct, even though it's not obvious to think about
> > a case where you wouldn't have a video device to grab the frames.
> > 
> > For instance you can see this being done here:
> > https://elixir.bootlin.com/linux/latest/source/drivers/media/i2c/ov5648.c#L2259
> > 
> > I'm just not sure about what the V4L2 subdev API mandates. It would be useful
> > to find some piece of documentation that clarifies the requirement.
> 
> Ok, I will split the functions then.

I was more interested in finding out the right answer rather than having you
follow an example from another driver. You can see the docs at:
https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/vidioc-subdev-g-fmt.html#return-value

So I think it's a good measure to return -EBUSY here. You can just have set_fmt
call into get_fmt with an extra check before.

Also see the part about the which field. I'm not sure it should have
implications in your case but better double-check that too.

Cheers,

Paul

-- 
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ