[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aRIHH4czX7dm+ZAo@lizhi-Precision-Tower-5810>
Date: Mon, 10 Nov 2025 10:39:11 -0500
From: Frank Li <Frank.li@....com>
To: Philipp Zabel <p.zabel@...gutronix.de>
Cc: Steve Longerbeam <slongerbeam@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, imx@...ts.linux.dev,
linux-media@...r.kernel.org, linux-staging@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/6] media: staging: media: imx6-mipi-csi2: use
devm_add_action_or_reset() to simplify code
On Mon, Nov 10, 2025 at 09:28:24AM +0100, Philipp Zabel wrote:
> On Fr, 2025-11-07 at 15:44 -0500, Frank Li wrote:
> > Use devm_add_action_or_reset() to simplify the code. No functional change.
> >
> > Signed-off-by: Frank Li <Frank.Li@....com>
> > ---
> > drivers/staging/media/imx/imx6-mipi-csi2.c | 16 ++++++++++++----
> > 1 file changed, 12 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c
> > index 42256441b881d9f132ad7ff899d6f1e35643b4ac..eba9a650030f5e380aa900b94728ad375171c6a5 100644
> > --- a/drivers/staging/media/imx/imx6-mipi-csi2.c
> > +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c
> > @@ -716,6 +716,14 @@ static int csi2_async_register(struct csi2_dev *csi2)
> > return ret;
> > }
> >
> > +static void csi2_nf_cleanup(void *data)
> > +{
> > + struct csi2_dev *csi2 = data;
> > +
> > + v4l2_async_nf_unregister(&csi2->notifier);
> > + v4l2_async_nf_cleanup(&csi2->notifier);
> > +}
> > +
> > static int csi2_probe(struct platform_device *pdev)
> > {
> > struct csi2_dev *csi2;
> > @@ -749,6 +757,10 @@ static int csi2_probe(struct platform_device *pdev)
> > if (ret)
> > return ret;
> >
> > + ret = devm_add_action_or_reset(&pdev->dev, csi2_nf_cleanup, csi2);
> > + if (ret)
> > + return ret;
> > +
> > csi2->pllref_clk = devm_clk_get(&pdev->dev, "ref");
> > if (IS_ERR(csi2->pllref_clk)) {
> > v4l2_err(&csi2->sd, "failed to get pll reference clock\n");
> > @@ -800,8 +812,6 @@ static int csi2_probe(struct platform_device *pdev)
> > return 0;
> >
> > clean_notifier:
> > - v4l2_async_nf_unregister(&csi2->notifier);
> > - v4l2_async_nf_cleanup(&csi2->notifier);
> > clk_disable_unprepare(csi2->dphy_clk);
> > pllref_off:
> > clk_disable_unprepare(csi2->pllref_clk);
> > @@ -815,8 +825,6 @@ static void csi2_remove(struct platform_device *pdev)
> > struct v4l2_subdev *sd = platform_get_drvdata(pdev);
> > struct csi2_dev *csi2 = sd_to_dev(sd);
> >
> > - v4l2_async_nf_unregister(&csi2->notifier);
> > - v4l2_async_nf_cleanup(&csi2->notifier);
> > v4l2_async_unregister_subdev(sd);
>
> This effectively moves the notifier unregister after the subdev
> unregister. Is that safe to do?
Good question:
I think, it'd better to provide devm_v4l2_*() helper functions for these.
I am not sure why there are not devm_v4l2*() helper functions now.
Frank
>
>
> regards
> Philipp
Powered by blists - more mailing lists