From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: arash golgol <arash.golgol@gmail.com>
Cc: linux-media@vger.kernel.org, paulk@sys-base.io,
mchehab@kernel.org, wens@kernel.org, jernej.skrabec@gmail.com,
samuel@sholland.org, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH] media: sun6i-mipi-csi2: Use V4L2 subdev active state
Date: Sun, 8 Feb 2026 16:07:02 +0200 [thread overview]
Message-ID: <20260208140702.GQ1376807@killaraus.ideasonboard.com> (raw)
In-Reply-To: <CAMxPZkid_QP2Q0wk9wBJi3RnfzbZ38CRso+BkT+srQTYwEmfOw@mail.gmail.com>
On Sun, Feb 08, 2026 at 02:23:39PM +0330, arash golgol wrote:
> Hi Laurent,
>
> Thank you for the careful review and the detailed comments.
>
> On Sun, Feb 8, 2026 at 1:19 AM Laurent Pinchart wrote:
> > On Fri, Feb 06, 2026 at 04:04:55PM +0330, Arash Golgol wrote:
> ...
> >
> > You can drop the else and write
> >
> > ret = v4l2_subdev_call(source_subdev, video, s_stream, 1);
> > if (ret && ret != -ENOIOCTLCMD)
> > goto disable;
> >
> > ret = 0;
> > goto unlock;
> >
>
> Sure, I'll do this in v2.
>
> >
> > Error paths below should call v4l2_subdev_cleanup(), which should be ...
> > ... introduced here:
> >
> > error_v4l2_subdev_cleanup:
> > v4l2_subdev_cleanup(subdev);
>
> Yes, you're right about error handling.
> I was checking the code for the proper place to jump to the
> error_v4l2_subdev_cleanup label.
> Consider this section of code, trying to set up the bridge upstream
> source (in middle of
> sun6i_mipi_csi2_bridge_setup()).
>
> ret = sun6i_mipi_csi2_bridge_source_setup(csi2_dev);
> if (ret && ret != -ENODEV)
> goto error_v4l2_notifier_cleanup;
>
> (rest of the code)
>
> error_v4l2_notifier_cleanup:
> v4l2_async_nf_cleanup(notifier);
>
> I was wondering whether jumping to error_v4l2_notifier_cleanup on failure of
> sun6i_mipi_csi2_bridge_source_setup() is meaningful, as in that case no
> async connection has been added to the notifier yet.
It doesn't seem needed indeed, but it also doesn't hurt.
> So I guess failure of sun6i_mipi_csi2_bridge_source_setup() could be a
> proper place to jump to
> error_v4l2_subdev_cleanup label. In this model, failure to set up the
> upstream source means
> the bridge cannot function at all, so I unwind back to subdev_cleanup().
>
> Something like this:
>
> ret = v4l2_subdev_init_finalize(subdev);
> if (ret < 0)
> goto error_media_entity_cleanup;
>
> /* V4L2 Async */
>
> v4l2_async_subdev_nf_init(notifier, subdev);
> notifier->ops = &sun6i_mipi_csi2_notifier_ops;
>
> ret = sun6i_mipi_csi2_bridge_source_setup(csi2_dev);
> if (ret && ret != -ENODEV)
> goto error_v4l2_subdev_cleanup;
>
> (rest of the code ... )
>
> error_v4l2_subdev_cleanup:
> v4l2_subdev_cleanup(subdev);
>
> error_media_entity_cleanup:
> media_entity_cleanup(&subdev->entity);
>
> Is my understanding correct?
> If yes, should I add this change to v2 too?
That looks good to me.
> > Those are only small issues, overall the patch is very nice. Thank you
> > for taking the extra step to convert the driver to the V4L2 subdev
> > active state. I expect we'll merge the next version once the comments
> > are addressed.
>
> Thank you for your kind words.
> I've prepared v2 and addressed your comments, but I wanted to clarify
> the correct error handling approach here before sending it.
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2026-02-08 14:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 12:34 [PATCH] media: sun6i-mipi-csi2: Use V4L2 subdev active state Arash Golgol
2026-02-07 21:49 ` Laurent Pinchart
2026-02-08 10:53 ` arash golgol
2026-02-08 14:07 ` Laurent Pinchart [this message]
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=20260208140702.GQ1376807@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=arash.golgol@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=paulk@sys-base.io \
--cc=samuel@sholland.org \
--cc=wens@kernel.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