From: Frank Li <Frank.li@nxp.com>
To: Marco Felsch <m.felsch@pengutronix.de>
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 v2 09/10] dmaengine: imx-sdma: make use of devm_add_action_or_reset to unregiser the dma-controller
Date: Fri, 12 Sep 2025 10:50:28 -0400 [thread overview]
Message-ID: <aMQzNDE8QuUZwGkt@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250911-v6-16-topic-sdma-v2-9-d315f56343b5@pengutronix.de>
On Thu, Sep 11, 2025 at 11:56:50PM +0200, Marco Felsch wrote:
> Use the devres capabilities to cleanup the driver remove() callback.
>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> drivers/dma/imx-sdma.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> index d6d0d4300f540268a3ab4a6b14af685f7b93275a..a7e6554ca223e2e980caf2e2dea832db9ad60ed6 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -2264,6 +2264,13 @@ static struct dma_chan *sdma_xlate(struct of_phandle_args *dma_spec,
> ofdma->of_node);
> }
>
> +static void sdma_dma_of_dma_controller_unregister_action(void *data)
> +{
> + struct sdma_engine *sdma = data;
> +
> + of_dma_controller_free(sdma->dev->of_node);
> +}
> +
> static void sdma_dma_device_unregister_action(void *data)
> {
> struct sdma_engine *sdma = data;
> @@ -2408,6 +2415,12 @@ static int sdma_probe(struct platform_device *pdev)
> return ret;
> }
>
> + ret = devm_add_action_or_reset(dev, sdma_dma_of_dma_controller_unregister_action, sdma);
> + if (ret) {
> + dev_err(dev, "failed to register of-dma-controller unregister hook\n");
> + return ret;
> + }
> +
return dev_err_probe()
Frank
> /*
> * Because that device tree does not encode ROM script address,
> * the RAM script in firmware is mandatory for device tree
> @@ -2431,7 +2444,6 @@ static void sdma_remove(struct platform_device *pdev)
> struct sdma_engine *sdma = platform_get_drvdata(pdev);
> int i;
>
> - of_dma_controller_free(sdma->dev->of_node);
> /* Kill the tasklet */
> for (i = 0; i < MAX_DMA_CHANNELS; i++) {
> struct sdma_channel *sdmac = &sdma->channel[i];
>
> --
> 2.47.3
>
next prev parent reply other threads:[~2025-09-12 14:50 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-11 21:56 [PATCH v2 00/10] i.MX SDMA cleanups and fixes Marco Felsch
2025-09-11 21:56 ` [PATCH v2 01/10] dmaengine: imx-sdma: fix missing of_dma_controller_free() Marco Felsch
2025-09-12 2:59 ` Peng Fan
2025-09-12 14:39 ` Frank Li
2025-09-11 21:56 ` [PATCH v2 02/10] dmaengine: imx-sdma: fix spba-bus handling for i.MX8M Marco Felsch
2025-09-12 3:02 ` Peng Fan
2025-09-12 8:48 ` Marco Felsch
2025-09-12 15:18 ` Frank Li
2025-09-12 15:27 ` Marco Felsch
2025-09-12 16:57 ` Frank Li
2025-10-01 10:31 ` Marco Felsch
2025-09-16 2:01 ` Peng Fan
2026-04-02 3:33 ` Shengjiu Wang
2025-09-11 21:56 ` [PATCH v2 03/10] dmaengine: imx-sdma: drop legacy device_node np check Marco Felsch
2025-09-12 3:04 ` Peng Fan
2025-09-11 21:56 ` [PATCH v2 04/10] dmaengine: imx-sdma: sdma_remove minor cleanups Marco Felsch
2025-09-12 3:06 ` Peng Fan
2025-09-11 21:56 ` [PATCH v2 05/10] dmaengine: imx-sdma: cosmetic cleanup Marco Felsch
2025-09-12 3:09 ` Peng Fan
2025-09-11 21:56 ` [PATCH v2 06/10] dmaengine: imx-sdma: make use of devm_kzalloc for script_addrs Marco Felsch
2025-09-12 4:00 ` Peng Fan
2025-09-11 21:56 ` [PATCH v2 07/10] dmaengine: imx-sdma: make use of devm_clk_get_prepared() Marco Felsch
2025-09-12 4:02 ` Peng Fan
2025-09-11 21:56 ` [PATCH v2 08/10] dmaengine: imx-sdma: make use of devm_add_action_or_reset to unregiser the dma_device Marco Felsch
2025-09-12 4:02 ` Peng Fan
2025-09-12 14:49 ` Frank Li
2025-09-12 15:25 ` Marco Felsch
2025-09-12 16:37 ` Frank Li
2025-09-12 16:49 ` Marco Felsch
2025-09-11 21:56 ` [PATCH v2 09/10] dmaengine: imx-sdma: make use of devm_add_action_or_reset to unregiser the dma-controller Marco Felsch
2025-09-12 4:06 ` Peng Fan
2025-09-12 14:50 ` Frank Li [this message]
2025-09-12 15:28 ` Marco Felsch
2025-09-12 16:39 ` Frank Li
2025-09-11 21:56 ` [PATCH v2 10/10] dmaengine: imx-sdma: make use of dev_err_probe() Marco Felsch
2025-09-12 4:07 ` Peng Fan
2026-02-25 15:59 ` [PATCH v2 00/10] i.MX SDMA cleanups and fixes Frank Li
2026-02-25 17:05 ` Marco Felsch
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=aMQzNDE8QuUZwGkt@lizhi-Precision-Tower-5810 \
--to=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=m.felsch@pengutronix.de \
--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