[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250911-v6-16-topic-sdma-v2-9-d315f56343b5@pengutronix.de>
Date: Thu, 11 Sep 2025 23:56:50 +0200
From: Marco Felsch <m.felsch@...gutronix.de>
To: Vinod Koul <vkoul@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Jiada Wang <jiada_wang@...tor.com>
Cc: dmaengine@...r.kernel.org, imx@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Marco Felsch <m.felsch@...gutronix.de>
Subject: [PATCH v2 09/10] dmaengine: imx-sdma: make use of
devm_add_action_or_reset to unregiser the dma-controller
Use the devres capabilities to cleanup the driver remove() callback.
Signed-off-by: Marco Felsch <m.felsch@...gutronix.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;
+ }
+
/*
* 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
Powered by blists - more mailing lists