* [PATCH 0/3] imx7-media-csi: small cleanup
@ 2023-03-16 14:38 Alexander Stein
2023-03-16 14:38 ` [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init Alexander Stein
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Alexander Stein @ 2023-03-16 14:38 UTC (permalink / raw)
To: Rui Miguel Silva, Laurent Pinchart, Mauro Carvalho Chehab,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team
Cc: Alexander Stein, linux-media, linux-arm-kernel
Hi all,
this is a small series for 7mx-media-csi cleanup. Namely early return
when invalid v4l2_buf_type is passed.
Also init v4l2_field during initialization.
Regards,
Alexander
Alexander Stein (3):
media: imx: imx7-media-csi: Fix mbus framefmt field init
media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION
media: imx: imx7-media-csi: Fail for non video-capture formats
drivers/media/platform/nxp/imx7-media-csi.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init 2023-03-16 14:38 [PATCH 0/3] imx7-media-csi: small cleanup Alexander Stein @ 2023-03-16 14:38 ` Alexander Stein 2023-03-17 17:20 ` Rui Miguel Silva 2023-03-16 14:38 ` [PATCH 2/3] media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION Alexander Stein 2023-03-16 14:38 ` [PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats Alexander Stein 2 siblings, 1 reply; 12+ messages in thread From: Alexander Stein @ 2023-03-16 14:38 UTC (permalink / raw) To: Rui Miguel Silva, Laurent Pinchart, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team Cc: Alexander Stein, linux-media, linux-arm-kernel Default to non-interleaving. Fixes: bc0d3df31ffe ("media: imx: imx7-media-csi: Simplify imx7_csi_video_init_format()") Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> --- drivers/media/platform/nxp/imx7-media-csi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index c22bf5c827e7..3e97b9f2ff69 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -1610,6 +1610,7 @@ static int imx7_csi_video_init_format(struct imx7_csi *csi) format.code = IMX7_CSI_DEF_MBUS_CODE; format.width = IMX7_CSI_DEF_PIX_WIDTH; format.height = IMX7_CSI_DEF_PIX_HEIGHT; + format.field = V4L2_FIELD_NONE; imx7_csi_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &format, NULL); csi->vdev_compose.width = format.width; -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init 2023-03-16 14:38 ` [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init Alexander Stein @ 2023-03-17 17:20 ` Rui Miguel Silva 2023-03-17 18:28 ` Laurent Pinchart 0 siblings, 1 reply; 12+ messages in thread From: Rui Miguel Silva @ 2023-03-17 17:20 UTC (permalink / raw) To: Alexander Stein, Laurent Pinchart, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team Cc: Alexander Stein, linux-media, linux-arm-kernel Hi Alexander, Thanks for the patch. Alexander Stein <alexander.stein@ew.tq-group.com> writes: > Default to non-interleaving. Why? > > Fixes: bc0d3df31ffe ("media: imx: imx7-media-csi: Simplify imx7_csi_video_init_format()") It was never init to FIELD_NONE even before this patch, do you think it is really a fix? Cheers, Rui > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> > --- > drivers/media/platform/nxp/imx7-media-csi.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c > index c22bf5c827e7..3e97b9f2ff69 100644 > --- a/drivers/media/platform/nxp/imx7-media-csi.c > +++ b/drivers/media/platform/nxp/imx7-media-csi.c > @@ -1610,6 +1610,7 @@ static int imx7_csi_video_init_format(struct imx7_csi *csi) > format.code = IMX7_CSI_DEF_MBUS_CODE; > format.width = IMX7_CSI_DEF_PIX_WIDTH; > format.height = IMX7_CSI_DEF_PIX_HEIGHT; > + format.field = V4L2_FIELD_NONE; > > imx7_csi_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &format, NULL); > csi->vdev_compose.width = format.width; > -- > 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init 2023-03-17 17:20 ` Rui Miguel Silva @ 2023-03-17 18:28 ` Laurent Pinchart 2023-03-17 19:20 ` Rui Miguel Silva 0 siblings, 1 reply; 12+ messages in thread From: Laurent Pinchart @ 2023-03-17 18:28 UTC (permalink / raw) To: Rui Miguel Silva Cc: Alexander Stein, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, linux-media, linux-arm-kernel Hello, On Fri, Mar 17, 2023 at 05:20:55PM +0000, Rui Miguel Silva wrote: > Hi Alexander, > Thanks for the patch. > > Alexander Stein <alexander.stein@ew.tq-group.com> writes: > > > Default to non-interleaving. > > Why? Otherwise it is implicitly set to V4L2_FIELD_ANY as the structure is zero-initialized, and that's not a valid value for drivers to return to userspace. This should be explained in the commit message. > > Fixes: bc0d3df31ffe ("media: imx: imx7-media-csi: Simplify imx7_csi_video_init_format()") > > It was never init to FIELD_NONE even before this patch, do you think it > is really a fix? Commit bc0d3df31ffe does indeed not seem relevant. The problem predates the destaging of the driver, it's a bit difficult to trace. I'd drop the Fixes: tag. > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> > > --- > > drivers/media/platform/nxp/imx7-media-csi.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c > > index c22bf5c827e7..3e97b9f2ff69 100644 > > --- a/drivers/media/platform/nxp/imx7-media-csi.c > > +++ b/drivers/media/platform/nxp/imx7-media-csi.c > > @@ -1610,6 +1610,7 @@ static int imx7_csi_video_init_format(struct imx7_csi *csi) > > format.code = IMX7_CSI_DEF_MBUS_CODE; > > format.width = IMX7_CSI_DEF_PIX_WIDTH; > > format.height = IMX7_CSI_DEF_PIX_HEIGHT; > > + format.field = V4L2_FIELD_NONE; > > > > imx7_csi_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &format, NULL); > > csi->vdev_compose.width = format.width; -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init 2023-03-17 18:28 ` Laurent Pinchart @ 2023-03-17 19:20 ` Rui Miguel Silva 0 siblings, 0 replies; 12+ messages in thread From: Rui Miguel Silva @ 2023-03-17 19:20 UTC (permalink / raw) To: Laurent Pinchart Cc: Alexander Stein, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, linux-media, linux-arm-kernel Hi Laurent. Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes: > Hello, > > On Fri, Mar 17, 2023 at 05:20:55PM +0000, Rui Miguel Silva wrote: >> Hi Alexander, >> Thanks for the patch. >> >> Alexander Stein <alexander.stein@ew.tq-group.com> writes: >> >> > Default to non-interleaving. >> >> Why? > > Otherwise it is implicitly set to V4L2_FIELD_ANY as the structure is > zero-initialized, and that's not a valid value for drivers to return to > userspace. This should be explained in the commit message. Yes, that was my intention, to have the why in the commit message. Cheers, Rui > >> > Fixes: bc0d3df31ffe ("media: imx: imx7-media-csi: Simplify imx7_csi_video_init_format()") >> >> It was never init to FIELD_NONE even before this patch, do you think it >> is really a fix? > > Commit bc0d3df31ffe does indeed not seem relevant. > > The problem predates the destaging of the driver, it's a bit difficult > to trace. I'd drop the Fixes: tag. > >> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> >> > --- >> > drivers/media/platform/nxp/imx7-media-csi.c | 1 + >> > 1 file changed, 1 insertion(+) >> > >> > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c >> > index c22bf5c827e7..3e97b9f2ff69 100644 >> > --- a/drivers/media/platform/nxp/imx7-media-csi.c >> > +++ b/drivers/media/platform/nxp/imx7-media-csi.c >> > @@ -1610,6 +1610,7 @@ static int imx7_csi_video_init_format(struct imx7_csi *csi) >> > format.code = IMX7_CSI_DEF_MBUS_CODE; >> > format.width = IMX7_CSI_DEF_PIX_WIDTH; >> > format.height = IMX7_CSI_DEF_PIX_HEIGHT; >> > + format.field = V4L2_FIELD_NONE; >> > >> > imx7_csi_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &format, NULL); >> > csi->vdev_compose.width = format.width; > > -- > Regards, > > Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/3] media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION 2023-03-16 14:38 [PATCH 0/3] imx7-media-csi: small cleanup Alexander Stein 2023-03-16 14:38 ` [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init Alexander Stein @ 2023-03-16 14:38 ` Alexander Stein 2023-03-17 18:32 ` Laurent Pinchart 2023-03-16 14:38 ` [PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats Alexander Stein 2 siblings, 1 reply; 12+ messages in thread From: Alexander Stein @ 2023-03-16 14:38 UTC (permalink / raw) To: Rui Miguel Silva, Laurent Pinchart, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team Cc: Alexander Stein, linux-media, linux-arm-kernel This device only supports video capture, so bail out if invalid selection type is passed. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> --- drivers/media/platform/nxp/imx7-media-csi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index 3e97b9f2ff69..389d7d88b341 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -1214,6 +1214,9 @@ static int imx7_csi_video_g_selection(struct file *file, void *fh, { struct imx7_csi *csi = video_drvdata(file); + if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + switch (s->target) { case V4L2_SEL_TGT_COMPOSE: case V4L2_SEL_TGT_COMPOSE_DEFAULT: -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION 2023-03-16 14:38 ` [PATCH 2/3] media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION Alexander Stein @ 2023-03-17 18:32 ` Laurent Pinchart 2023-03-17 19:21 ` Rui Miguel Silva 0 siblings, 1 reply; 12+ messages in thread From: Laurent Pinchart @ 2023-03-17 18:32 UTC (permalink / raw) To: Alexander Stein Cc: Rui Miguel Silva, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, linux-media, linux-arm-kernel Hi Alexander, Thank you for the patch. On Thu, Mar 16, 2023 at 03:38:28PM +0100, Alexander Stein wrote: > This device only supports video capture, so bail out if invalid > selection type is passed. > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > drivers/media/platform/nxp/imx7-media-csi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c > index 3e97b9f2ff69..389d7d88b341 100644 > --- a/drivers/media/platform/nxp/imx7-media-csi.c > +++ b/drivers/media/platform/nxp/imx7-media-csi.c > @@ -1214,6 +1214,9 @@ static int imx7_csi_video_g_selection(struct file *file, void *fh, > { > struct imx7_csi *csi = video_drvdata(file); > > + if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) > + return -EINVAL; > + > switch (s->target) { > case V4L2_SEL_TGT_COMPOSE: > case V4L2_SEL_TGT_COMPOSE_DEFAULT: -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION 2023-03-17 18:32 ` Laurent Pinchart @ 2023-03-17 19:21 ` Rui Miguel Silva 0 siblings, 0 replies; 12+ messages in thread From: Rui Miguel Silva @ 2023-03-17 19:21 UTC (permalink / raw) To: Laurent Pinchart, Alexander Stein Cc: Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, linux-media, linux-arm-kernel Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes: > Hi Alexander, > > Thank you for the patch. > > On Thu, Mar 16, 2023 at 03:38:28PM +0100, Alexander Stein wrote: >> This device only supports video capture, so bail out if invalid >> selection type is passed. >> >> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Cheers, Rui > >> --- >> drivers/media/platform/nxp/imx7-media-csi.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c >> index 3e97b9f2ff69..389d7d88b341 100644 >> --- a/drivers/media/platform/nxp/imx7-media-csi.c >> +++ b/drivers/media/platform/nxp/imx7-media-csi.c >> @@ -1214,6 +1214,9 @@ static int imx7_csi_video_g_selection(struct file *file, void *fh, >> { >> struct imx7_csi *csi = video_drvdata(file); >> >> + if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) >> + return -EINVAL; >> + >> switch (s->target) { >> case V4L2_SEL_TGT_COMPOSE: >> case V4L2_SEL_TGT_COMPOSE_DEFAULT: > > -- > Regards, > > Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats 2023-03-16 14:38 [PATCH 0/3] imx7-media-csi: small cleanup Alexander Stein 2023-03-16 14:38 ` [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init Alexander Stein 2023-03-16 14:38 ` [PATCH 2/3] media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION Alexander Stein @ 2023-03-16 14:38 ` Alexander Stein 2023-03-17 17:23 ` Rui Miguel Silva 2 siblings, 1 reply; 12+ messages in thread From: Alexander Stein @ 2023-03-16 14:38 UTC (permalink / raw) To: Rui Miguel Silva, Laurent Pinchart, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team Cc: Alexander Stein, linux-media, linux-arm-kernel This driver only support V4L2_BUF_TYPE_VIDEO_CAPTURE, so fail for other passed types. Signed-off-by: Alexander Stein <alexander.stein@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); + + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + __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; + if (vb2_is_busy(&csi->q)) { dev_err(csi->dev, "%s queue busy\n", __func__); return -EBUSY; -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats 2023-03-16 14:38 ` [PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats Alexander Stein @ 2023-03-17 17:23 ` Rui Miguel Silva 2023-03-17 17:57 ` Laurent Pinchart 0 siblings, 1 reply; 12+ messages in thread From: Rui Miguel Silva @ 2023-03-17 17:23 UTC (permalink / raw) To: Alexander Stein, Laurent Pinchart, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team Cc: Alexander Stein, linux-media, linux-arm-kernel Hi Alexander, thanks for the patch. Alexander Stein <alexander.stein@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@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. > + > + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) > + return -EINVAL; Is this function ever called if f->type is not TYPE_VIDEO_CAPTURE? > + > __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; > -- > 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats 2023-03-17 17:23 ` Rui Miguel Silva @ 2023-03-17 17:57 ` Laurent Pinchart 2023-03-21 7:18 ` Alexander Stein 0 siblings, 1 reply; 12+ messages in thread From: Laurent Pinchart @ 2023-03-17 17:57 UTC (permalink / raw) To: Rui Miguel Silva Cc: Alexander Stein, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, linux-media, linux-arm-kernel On Fri, Mar 17, 2023 at 05:23:29PM +0000, Rui Miguel Silva wrote: > Hi Alexander, > thanks for the patch. > > Alexander Stein <alexander.stein@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@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. > > > + > > + 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. > > + > > __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; -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats 2023-03-17 17:57 ` Laurent Pinchart @ 2023-03-21 7:18 ` Alexander Stein 0 siblings, 0 replies; 12+ messages in thread From: Alexander Stein @ 2023-03-21 7:18 UTC (permalink / raw) To: Rui Miguel Silva, Laurent Pinchart Cc: Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, linux-media, linux-arm-kernel 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@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@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/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-03-21 7:20 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-03-16 14:38 [PATCH 0/3] imx7-media-csi: small cleanup Alexander Stein 2023-03-16 14:38 ` [PATCH 1/3] media: imx: imx7-media-csi: Fix mbus framefmt field init Alexander Stein 2023-03-17 17:20 ` Rui Miguel Silva 2023-03-17 18:28 ` Laurent Pinchart 2023-03-17 19:20 ` Rui Miguel Silva 2023-03-16 14:38 ` [PATCH 2/3] media: imx: imx7-media-csi: Fail on invalid type in VIDIOC_G_SELECTION Alexander Stein 2023-03-17 18:32 ` Laurent Pinchart 2023-03-17 19:21 ` Rui Miguel Silva 2023-03-16 14:38 ` [PATCH 3/3] media: imx: imx7-media-csi: Fail for non video-capture formats Alexander Stein 2023-03-17 17:23 ` Rui Miguel Silva 2023-03-17 17:57 ` Laurent Pinchart 2023-03-21 7:18 ` Alexander Stein
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).