[PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats

Alexander Stein alexander.stein at ew.tq-group.com
Tue Mar 21 00:18:53 PDT 2023


Hi all,

Am Freitag, 17. März 2023, 18:57:44 CET schrieb Laurent Pinchart:
> On Fri, Mar 17, 2023 at 05:23:29PM +0000, Rui Miguel Silva wrote:
> > Hi Alexander,
> > thanks for the patch.
> > 
> > Alexander Stein <alexander.stein at ew.tq-group.com> writes:
> > > This driver only support V4L2_BUF_TYPE_VIDEO_CAPTURE, so fail for other
> > > passed types.
> > > 
> > > Signed-off-by: Alexander Stein <alexander.stein at ew.tq-group.com>
> > > ---
> > > 
> > >  drivers/media/platform/nxp/imx7-media-csi.c | 8 ++++++++
> > >  1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c
> > > b/drivers/media/platform/nxp/imx7-media-csi.c index
> > > 389d7d88b341..e470b0505d3b 100644
> > > --- a/drivers/media/platform/nxp/imx7-media-csi.c
> > > +++ b/drivers/media/platform/nxp/imx7-media-csi.c
> > > @@ -1186,6 +1186,11 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format
> > > *pixfmt,> > 
> > >  static int imx7_csi_video_try_fmt_vid_cap(struct file *file, void *fh,
> > >  
> > >  					  struct v4l2_format *f)
> > >  
> > >  {
> > > 
> > > +	struct imx7_csi *csi = video_drvdata(file);
> > 
> > Maybe copy/paste problem csi is never used.

Yes, leftover from reordering patches.

> > > +
> > > +	if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> > > +		return -EINVAL;
> > 
> > Is this function ever called if f->type is not TYPE_VIDEO_CAPTURE?
> 
> It shouldn't, v4l_g_fmt() and v4l_s_fmt() check the type and call the
> appropriate operation accordingly. I don't think this patch is needed.

You are right. I was mislead by the fact that imx7_csi_video_g_selection does 
need this check.

Best regards,
Alexander

> > > +
> > > 
> > >  	__imx7_csi_video_try_fmt(&f->fmt.pix, NULL);
> > >  	return 0;
> > >  
> > >  }
> > > 
> > > @@ -1196,6 +1201,9 @@ static int imx7_csi_video_s_fmt_vid_cap(struct
> > > file *file, void *fh,> > 
> > >  	struct imx7_csi *csi = video_drvdata(file);
> > >  	const struct imx7_csi_pixfmt *cc;
> > > 
> > > +	if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
> > > +		return -EINVAL;
> > 
> > Ditto?
> > 
> > Cheers,
> > 
> >    Rui
> > > 
> > > +
> > > 
> > >  	if (vb2_is_busy(&csi->q)) {
> > >  	
> > >  		dev_err(csi->dev, "%s queue busy\n", __func__);
> > >  		return -EBUSY;


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/





More information about the linux-arm-kernel mailing list