[PATCH v2 6/9] dmaengine: tegra: Use managed DMA controller registration

Akhil R
2026-03-02T12:36:11Z

Switch to dmaenginem_async_device_register() for managed
registration and to simplify the error path in the probe.

Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Suggested-by: Frank Li <frank.li@nxp.com>
---
drivers/dma/tegra186-gpc-dma.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index 753e86d05a02..5997edaba28e 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -1497,7 +1497,7 @@ static int tegra_dma_probe(struct platform_device *pdev)
tdma->dma_dev.device_synchronize = tegra_dma_chan_synchronize;
tdma->dma_dev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;

- ret = dma_async_device_register(&tdma->dma_dev);
+ ret = dmaenginem_async_device_register(&tdma->dma_dev);
if (ret < 0) {
dev_err_probe(&pdev->dev, ret,
"GPC DMA driver registration failed\n");
@@ -1509,12 +1509,10 @@ static int tegra_dma_probe(struct platform_device *pdev)
if (ret < 0) {
dev_err_probe(&pdev->dev, ret,
"GPC DMA OF registration failed\n");
-
- dma_async_device_unregister(&tdma->dma_dev);
return ret;
}

- dev_info(&pdev->dev, "GPC DMA driver register %lu channels\n",
+ dev_info(&pdev->dev, "GPC DMA driver registered %lu channels\n",
hweight_long(tdma->chan_mask));

return 0;
@@ -1522,10 +1520,7 @@ static int tegra_dma_probe(struct platform_device *pdev)

static void tegra_dma_remove(struct platform_device *pdev)
{
- struct tegra_dma *tdma = platform_get_drvdata(pdev);
-
of_dma_controller_free(pdev->dev.of_node);
- dma_async_device_unregister(&tdma->dma_dev);
}

static int __maybe_unused tegra_dma_pm_suspend(struct device *dev)
--
2.50.1