From: Rosen Penev <rosenp@gmail.com>
To: dmaengine@vger.kernel.org
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
linux-arm-kernel@lists.infradead.org (moderated list:MICROCHIP
AT91 DMA DRIVERS), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] dmaengine: at_hdmac: use more devm in _probe
Date: Wed, 22 Jul 2026 22:07:32 -0700 [thread overview]
Message-ID: <20260723050732.290935-1-rosenp@gmail.com> (raw)
As devm is already used in _probe, complete the conversion so that
everything unwinds in proper order.
Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/dma/at_hdmac.c | 49 ++++++++++--------------------------------
1 file changed, 11 insertions(+), 38 deletions(-)
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index e5b30a57c477..25d846ed7a7b 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1980,40 +1980,34 @@ static int __init at_dma_probe(struct platform_device *pdev)
atdma->dma_device.cap_mask = plat_dat->cap_mask;
atdma->all_chan_mask = (1 << plat_dat->nr_channels) - 1;
- atdma->clk = devm_clk_get(&pdev->dev, "dma_clk");
+ atdma->clk = devm_clk_get_enabled(&pdev->dev, "dma_clk");
if (IS_ERR(atdma->clk))
return PTR_ERR(atdma->clk);
- err = clk_prepare_enable(atdma->clk);
- if (err)
- return err;
-
/* force dma off, just in case */
at_dma_off(atdma);
- err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma);
+ err = devm_request_irq(&pdev->dev, irq, at_dma_interrupt, 0, "at_hdmac", atdma);
if (err)
- goto err_irq;
+ return err;
platform_set_drvdata(pdev, atdma);
/* create a pool of consistent memory blocks for hardware descriptors */
- atdma->lli_pool = dma_pool_create("at_hdmac_lli_pool",
+ atdma->lli_pool = dmam_pool_create("at_hdmac_lli_pool",
&pdev->dev, sizeof(struct at_lli),
4 /* word alignment */, 0);
if (!atdma->lli_pool) {
dev_err(&pdev->dev, "Unable to allocate DMA LLI descriptor pool\n");
- err = -ENOMEM;
- goto err_desc_pool_create;
+ return -ENOMEM;
}
/* create a pool of consistent memory blocks for memset blocks */
- atdma->memset_pool = dma_pool_create("at_hdmac_memset_pool",
+ atdma->memset_pool = dmam_pool_create("at_hdmac_memset_pool",
&pdev->dev, sizeof(int), 4, 0);
if (!atdma->memset_pool) {
dev_err(&pdev->dev, "No memory for memset dma pool\n");
- err = -ENOMEM;
- goto err_memset_pool_create;
+ return -ENOMEM;
}
/* clear any pending interrupt */
@@ -2080,10 +2074,10 @@ static int __init at_dma_probe(struct platform_device *pdev)
dma_has_cap(DMA_SLAVE, atdma->dma_device.cap_mask) ? "slave " : "",
plat_dat->nr_channels);
- err = dma_async_device_register(&atdma->dma_device);
+ err = dmaenginem_async_device_register(&atdma->dma_device);
if (err) {
dev_err(&pdev->dev, "Unable to register: %d.\n", err);
- goto err_dma_async_device_register;
+ return err;
}
/*
@@ -2092,27 +2086,15 @@ static int __init at_dma_probe(struct platform_device *pdev)
* dma_request_channel().
*/
if (pdev->dev.of_node) {
- err = of_dma_controller_register(pdev->dev.of_node,
+ err = devm_of_dma_controller_register(&pdev->dev, pdev->dev.of_node,
at_dma_xlate, atdma);
if (err) {
dev_err(&pdev->dev, "could not register of_dma_controller\n");
- goto err_of_dma_controller_register;
+ return err;
}
}
return 0;
-
-err_of_dma_controller_register:
- dma_async_device_unregister(&atdma->dma_device);
-err_dma_async_device_register:
- dma_pool_destroy(atdma->memset_pool);
-err_memset_pool_create:
- dma_pool_destroy(atdma->lli_pool);
-err_desc_pool_create:
- free_irq(platform_get_irq(pdev, 0), atdma);
-err_irq:
- clk_disable_unprepare(atdma->clk);
- return err;
}
static void at_dma_remove(struct platform_device *pdev)
@@ -2121,13 +2103,6 @@ static void at_dma_remove(struct platform_device *pdev)
struct dma_chan *chan, *_chan;
at_dma_off(atdma);
- if (pdev->dev.of_node)
- of_dma_controller_free(pdev->dev.of_node);
- dma_async_device_unregister(&atdma->dma_device);
-
- dma_pool_destroy(atdma->memset_pool);
- dma_pool_destroy(atdma->lli_pool);
- free_irq(platform_get_irq(pdev, 0), atdma);
list_for_each_entry_safe(chan, _chan, &atdma->dma_device.channels,
device_node) {
@@ -2135,8 +2110,6 @@ static void at_dma_remove(struct platform_device *pdev)
atc_disable_chan_irq(atdma, chan->chan_id);
list_del(&chan->device_node);
}
-
- clk_disable_unprepare(atdma->clk);
}
static void at_dma_shutdown(struct platform_device *pdev)
--
2.55.0
next reply other threads:[~2026-07-23 5:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 5:07 Rosen Penev [this message]
2026-07-23 5:16 ` [PATCH] dmaengine: at_hdmac: use more devm in _probe sashiko-bot
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=20260723050732.290935-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ludovic.desroches@microchip.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.