From: "Martin Povišer" <povik+lin@cutebit.org>
To: Hector Martin <marcan@marcan.st>, Sven Peter <sven@svenpeter.dev>,
Vinod Koul <vkoul@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: "Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
asahi@lists.linux.dev, dmaengine@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
"Martin Povišer" <povik+lin@cutebit.org>
Subject: [PATCH 3/4] dmaengine: apple-admac: Do not use devres for IRQs
Date: Sun, 18 Sep 2022 11:58:44 +0200 [thread overview]
Message-ID: <20220918095845.68860-4-povik+lin@cutebit.org> (raw)
In-Reply-To: <20220918095845.68860-1-povik+lin@cutebit.org>
This is in advance of adding support for triggering the reset signal to
the peripheral, since registering the IRQ handler will have to be
sequenced with it.
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
---
drivers/dma/apple-admac.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c
index d1f74a3aa999..7d1b76678032 100644
--- a/drivers/dma/apple-admac.c
+++ b/drivers/dma/apple-admac.c
@@ -96,6 +96,7 @@ struct admac_data {
struct device *dev;
__iomem void *base;
+ int irq;
int irq_index;
int nchannels;
struct admac_chan channels[];
@@ -724,12 +725,7 @@ static int admac_probe(struct platform_device *pdev)
if (irq < 0)
return dev_err_probe(&pdev->dev, irq, "no usable interrupt\n");
-
- err = devm_request_irq(&pdev->dev, irq, admac_interrupt,
- 0, dev_name(&pdev->dev), ad);
- if (err)
- return dev_err_probe(&pdev->dev, err,
- "unable to register interrupt\n");
+ ad->irq = irq;
ad->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ad->base))
@@ -774,17 +770,29 @@ static int admac_probe(struct platform_device *pdev)
tasklet_setup(&adchan->tasklet, admac_chan_tasklet);
}
- err = dma_async_device_register(&ad->dma);
+ err = request_irq(irq, admac_interrupt, 0, dev_name(&pdev->dev), ad);
if (err)
- return dev_err_probe(&pdev->dev, err, "failed to register DMA device\n");
+ return dev_err_probe(&pdev->dev, err,
+ "unable to register interrupt\n");
+
+ err = dma_async_device_register(&ad->dma);
+ if (err) {
+ dev_err_probe(&pdev->dev, err, "failed to register DMA device\n");
+ goto free_irq;
+ }
err = of_dma_controller_register(pdev->dev.of_node, admac_dma_of_xlate, ad);
if (err) {
dma_async_device_unregister(&ad->dma);
- return dev_err_probe(&pdev->dev, err, "failed to register with OF\n");
+ dev_err_probe(&pdev->dev, err, "failed to register with OF\n");
+ goto free_irq;
}
return 0;
+
+free_irq:
+ free_irq(ad->irq, ad);
+ return err;
}
static int admac_remove(struct platform_device *pdev)
@@ -793,6 +801,7 @@ static int admac_remove(struct platform_device *pdev)
of_dma_controller_free(pdev->dev.of_node);
dma_async_device_unregister(&ad->dma);
+ free_irq(ad->irq, ad);
return 0;
}
--
2.33.0
next prev parent reply other threads:[~2022-09-18 9:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-18 9:58 [PATCH 0/4] Apple ADMAC peripheral reset clean-up Martin Povišer
2022-09-18 9:58 ` [PATCH 1/4] dt-bindings: dma: apple,admac: Add reset Martin Povišer
2022-09-18 10:00 ` Krzysztof Kozlowski
2022-09-18 9:58 ` [PATCH 2/4] arm64: dts: apple: Add ADMAC resets on t8103/t600x Martin Povišer
2022-09-18 9:58 ` Martin Povišer [this message]
2022-09-29 16:14 ` [PATCH 3/4] dmaengine: apple-admac: Do not use devres for IRQs Vinod Koul
2022-09-18 9:58 ` [PATCH 4/4] dmaengine: apple-admac: Trigger shared reset Martin Povišer
2022-09-30 9:01 ` Philipp Zabel
2022-09-22 13:44 ` [PATCH 0/4] Apple ADMAC peripheral reset clean-up Hector Martin
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=20220918095845.68860-4-povik+lin@cutebit.org \
--to=povik+lin@cutebit.org \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=sven@svenpeter.dev \
--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