From: Marco Felsch <m.felsch@pengutronix.de>
To: Frank Li <Frank.li@nxp.com>
Cc: Vinod Koul <vkoul@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Jiada Wang <jiada_wang@mentor.com>,
dmaengine@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 06/11] dmaengine: imx-sdma: make use of devm_add_action_or_reset to unregiser the dma_device
Date: Wed, 10 Sep 2025 12:13:28 +0200 [thread overview]
Message-ID: <20250910101328.7rp5ulsrahpqfdtz@pengutronix.de> (raw)
In-Reply-To: <aLhWfPjnZZpKr/w1@lizhi-Precision-Tower-5810>
On 25-09-03, Frank Li wrote:
> On Wed, Sep 03, 2025 at 03:06:14PM +0200, Marco Felsch wrote:
> > Make use of the devm_add_action_or_reset() to register a custom devm_
> > release hook. This is required since we want to turn of the IRQs before
>
> turn off?
>
> > doing the dma_async_device_unregister().
> >
> > This removes the last goto error handling within the probe function and
>
> Remove the last ..
I rephrased the commit message.
> > further trims the remove() function. Instead of freeing the irq, we can
> > disable it and let the devm-irq do the job to free the irq, since the
> > only purpose was to have the irqs disabled before calling
> > dma_async_device_unregister().
> >
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> > drivers/dma/imx-sdma.c | 19 +++++++++++--------
> > 1 file changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> > index 5a571d3f33158813e0c56484600a49b19a6a72e2..f6bb2f88a62781c0431336c365fa30c46f1401ad 100644
> > --- a/drivers/dma/imx-sdma.c
> > +++ b/drivers/dma/imx-sdma.c
> > @@ -2232,6 +2232,14 @@ static struct dma_chan *sdma_xlate(struct of_phandle_args *dma_spec,
> > ofdma->of_node);
> > }
> >
> > +static void sdma_dma_device_unregister_action(void *data)
> > +{
> > + struct sdma_engine *sdma = data;
> > +
> > + disable_irq(sdma->irq);
> > + dma_async_device_unregister(&sdma->dma_device);
> > +}
> > +
> > static int sdma_probe(struct platform_device *pdev)
> > {
> > struct device *dev = &pdev->dev;
> > @@ -2358,10 +2366,12 @@ static int sdma_probe(struct platform_device *pdev)
> > return ret;
> > }
> >
> > + devm_add_action_or_reset(dev, sdma_dma_device_unregister_action, sdma);
> > +
>
> need check return value.
Sure, thanks.
Regards,
Marco
>
> Frank
>
> > ret = of_dma_controller_register(np, sdma_xlate, sdma);
> > if (ret) {
> > dev_err(dev, "failed to register controller\n");
> > - goto err_register;
> > + return ret;
> > }
> >
> > spba_bus = of_find_compatible_node(NULL, NULL, "fsl,spba-bus");
> > @@ -2388,11 +2398,6 @@ static int sdma_probe(struct platform_device *pdev)
> > }
> >
> > return 0;
> > -
> > -err_register:
> > - dma_async_device_unregister(&sdma->dma_device);
> > -
> > - return ret;
> > }
> >
> > static void sdma_remove(struct platform_device *pdev)
> > @@ -2400,8 +2405,6 @@ static void sdma_remove(struct platform_device *pdev)
> > struct sdma_engine *sdma = platform_get_drvdata(pdev);
> > int i;
> >
> > - devm_free_irq(&pdev->dev, sdma->irq, sdma);
> > - dma_async_device_unregister(&sdma->dma_device);
> > /* Kill the tasklet */
> > for (i = 0; i < MAX_DMA_CHANNELS; i++) {
> > struct sdma_channel *sdmac = &sdma->channel[i];
> >
> > --
> > 2.47.2
> >
>
next prev parent reply other threads:[~2025-09-10 10:13 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 13:06 [PATCH 00/11] i.MX SDMA cleanups and fixes Marco Felsch
2025-09-03 13:06 ` [PATCH 01/11] dmaengine: imx-sdma: drop legacy device_node np check Marco Felsch
2025-09-03 14:48 ` Frank Li
2025-09-03 13:06 ` [PATCH 02/11] dmaengine: imx-sdma: sdma_remove minor cleanups Marco Felsch
2025-09-03 14:50 ` Frank Li
2025-09-03 13:06 ` [PATCH 03/11] dmaengine: imx-sdma: cosmetic cleanup Marco Felsch
2025-09-03 14:55 ` Frank Li
2025-09-03 13:06 ` [PATCH 04/11] dmaengine: imx-sdma: make use of devm_kzalloc for script_addrs Marco Felsch
2025-09-03 15:00 ` Frank Li
2025-09-03 13:06 ` [PATCH 05/11] dmaengine: imx-sdma: make use of devm_clk_get_prepared() Marco Felsch
2025-09-03 15:01 ` Frank Li
2025-09-03 13:06 ` [PATCH 06/11] dmaengine: imx-sdma: make use of devm_add_action_or_reset to unregiser the dma_device Marco Felsch
2025-09-03 14:53 ` Frank Li
2025-09-10 10:13 ` Marco Felsch [this message]
2025-09-03 13:06 ` [PATCH 07/11] dmaengine: imx-sdma: make use of dev_err_probe() Marco Felsch
2025-09-03 15:04 ` Frank Li
2025-09-10 12:05 ` Marco Felsch
2025-09-03 13:06 ` [PATCH 08/11] dmaengine: imx-sdma: fix missing of_dma_controller_free() Marco Felsch
2025-09-03 15:08 ` Frank Li
2025-09-10 9:45 ` Marco Felsch
2025-09-03 13:06 ` [PATCH 09/11] dmaengine: add support for device_link Marco Felsch
2025-09-03 14:46 ` Frank Li
2025-09-09 12:03 ` Marco Felsch
2025-09-09 14:42 ` Frank Li
2025-09-10 9:34 ` Marco Felsch
2025-09-10 15:51 ` Frank Li
2025-09-10 19:35 ` Marco Felsch
2025-09-10 21:41 ` Frank Li
2025-09-11 11:50 ` Marco Felsch
2025-09-11 15:18 ` Frank Li
2025-09-11 19:23 ` Marco Felsch
2025-09-03 13:06 ` [PATCH 10/11] dmaengine: imx-sdma: drop remove callback Marco Felsch
2025-09-03 15:15 ` Frank Li
2025-09-03 13:06 ` [PATCH 11/11] dmaengine: imx-sdma: fix spba-bus handling for i.MX8M Marco Felsch
2025-09-04 4:31 ` kernel test robot
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=20250910101328.7rp5ulsrahpqfdtz@pengutronix.de \
--to=m.felsch@pengutronix.de \
--cc=Frank.li@nxp.com \
--cc=dmaengine@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jiada_wang@mentor.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=vkoul@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