ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: linux-media@vger.kernel.org, Chen-Yu Tsai <wens@csie.org>,
	Eugen Hristev <eugen.hristev@collabora.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Maxime Ripard <mripard@kernel.org>,
	Sakari Ailus <sakari.ailus@iki.fi>,
	linux-renesas-soc@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH v2 3/7] media: sun4i_csi: Don't use v4l2_subdev_link_validate() for video device
Date: Mon, 26 Aug 2024 14:56:00 +0300	[thread overview]
Message-ID: <20240826115600.GA27785@pendragon.ideasonboard.com> (raw)
In-Reply-To: <2d9c3516-442f-4e41-8620-cc0eaf9b1f03@ideasonboard.com>

On Mon, Aug 26, 2024 at 02:04:44PM +0300, Tomi Valkeinen wrote:
> On 22/08/2024 18:45, Laurent Pinchart wrote:
> > The v4l2_subdev_link_validate() function is a helper designed to
> > validate links whose sink is a subdev. When called on a link whose sink
> > is a video device, it only prints a warning and returns. Its usage in
> > the sun4i_csi driver is wrong, leaving the link from the sub4i_csi
> > subdev to the capture video device unvalidated.
> > 
> > Planned improvements to the v4l2_subdev_link_validate() function will
> > turn the warning into an error, breaking the sun4i_csi driver. As an
> > interim measure, move the warning to the sun4i_csi driver in a custom
> > validation handler, and drop the call to the helper.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> > Acked-by: Chen-Yu Tsai <wens@csie.org>
> > ---
> >   drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c | 9 ++++++++-
> >   1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
> > index dbb26c7b2f8d..d07e980aba61 100644
> > --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
> > +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
> > @@ -35,8 +35,15 @@ struct sun4i_csi_traits {
> >   	bool has_isp;
> >   };
> >   
> > +static int sun4i_csi_video_link_validate(struct media_link *link)
> > +{
> > +	dev_warn_once(link->graph_obj.mdev->dev,
> > +		      "Driver bug: link validation not implemented\n");
> > +	return 0;
> > +}
> > +
> >   static const struct media_entity_operations sun4i_csi_video_entity_ops = {
> > -	.link_validate = v4l2_subdev_link_validate,
> > +	.link_validate = sun4i_csi_video_link_validate,
> >   };
> >   
> >   static const struct media_entity_operations sun4i_csi_subdev_entity_ops = {
> 
> I fear this might just leave it broken, but I don't have a better idea.

I think it would be fairly easy to implement support for proper
validation in the driver, but it would require access to a device for
testing. This patch doesn't worsen the issue, or make fixing it more
difficult, so I think it's OK for now until someone can send a real fix.

> Reviewed-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-08-26 11:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 15:45 [PATCH v2 0/7] media: v4l2: Improve media link validation Laurent Pinchart
2024-08-22 15:45 ` [PATCH v2 1/7] media: microchip-isc: Drop v4l2_subdev_link_validate() for video devices Laurent Pinchart
2024-08-26 10:58   ` Tomi Valkeinen
2024-08-22 15:45 ` [PATCH v2 2/7] media: sun4i_csi: Implement link validate for sun4i_csi subdev Laurent Pinchart
2024-08-26 10:59   ` Tomi Valkeinen
2024-08-22 15:45 ` [PATCH v2 3/7] media: sun4i_csi: Don't use v4l2_subdev_link_validate() for video device Laurent Pinchart
2024-08-26 11:04   ` Tomi Valkeinen
2024-08-26 11:56     ` Laurent Pinchart [this message]
2024-08-22 15:45 ` [PATCH v2 4/7] media: v4l2-subdev: Refactor warnings in v4l2_subdev_link_validate() Laurent Pinchart
2024-08-26 11:10   ` Tomi Valkeinen
2024-08-26 12:05     ` Laurent Pinchart
2024-08-22 15:45 ` [PATCH v2 5/7] media: v4l2-subdev: Support hybrid links " Laurent Pinchart
2024-08-26 11:23   ` Tomi Valkeinen
2024-08-26 12:11     ` Laurent Pinchart
2024-08-22 15:45 ` [PATCH v2 6/7] media: renesas: vsp1: Implement .link_validate() for video devices Laurent Pinchart
2024-08-26 11:49   ` Tomi Valkeinen
2024-08-26 12:14     ` Laurent Pinchart
2024-08-22 15:45 ` [PATCH v2 7/7] [DNI] media: renesas: vsp1: Validate all links through .link_validate() Laurent Pinchart
2024-08-26 11:43   ` Tomi Valkeinen
2024-08-26 12:18     ` Laurent Pinchart
2024-08-26 12:22       ` Tomi Valkeinen
2024-08-26 12:25         ` Laurent Pinchart
2024-08-26 12:36           ` Tomi Valkeinen
  -- strict thread matches above, loose matches on Subject: below --
2024-08-22 15:35 [PATCH v2 0/7] media: v4l2: Improve media link validation Laurent Pinchart
2024-08-22 15:35 ` [PATCH v2 3/7] media: sun4i_csi: Don't use v4l2_subdev_link_validate() for video device Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240826115600.GA27785@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=eugen.hristev@collabora.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mripard@kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox