summaryrefslogtreecommitdiff
path: root/drivers/dma/tegra186-gpc-dma.c
diff options
context:
space:
mode:
authorAkhil R <akhilrajeev@nvidia.com>2022-05-05 14:44:40 +0530
committerVinod Koul <vkoul@kernel.org>2022-05-16 16:58:10 +0530
commit461cd3709f266d179064b0a63d8949fa2e75ff72 (patch)
treec1c9a9b353b20f616ac9abf68a2ebbe022b6738a /drivers/dma/tegra186-gpc-dma.c
parent99faef48e7a3f878848a2d711af710e36fadbd6e (diff)
downloadlwn-461cd3709f266d179064b0a63d8949fa2e75ff72.tar.gz
lwn-461cd3709f266d179064b0a63d8949fa2e75ff72.zip
dmaengine: tegra: Use platform_get_irq() to get IRQ resource
Use platform_irq_get() instead platform_get_resource() for IRQ resource to fix the probe failure. platform_get_resource() fails to fetch the IRQ resource as it might not be ready at that time. platform_irq_get() is also the recommended way to get interrupt as it directly gives the IRQ number and no conversion from resource is required. Fixes: ee17028009d4 ("dmaengine: tegra: Add tegra gpcdma driver") Reported-by: Jonathan Hunter <jonathanh@nvidia.com> Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20220505091440.12981-1-akhilrajeev@nvidia.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/tegra186-gpc-dma.c')
-rw-r--r--drivers/dma/tegra186-gpc-dma.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c
index 97fe0e9e9b83..3951db527dec 100644
--- a/drivers/dma/tegra186-gpc-dma.c
+++ b/drivers/dma/tegra186-gpc-dma.c
@@ -1328,7 +1328,6 @@ static int tegra_dma_probe(struct platform_device *pdev)
struct iommu_fwspec *iommu_spec;
unsigned int stream_id, i;
struct tegra_dma *tdma;
- struct resource *res;
int ret;
cdata = of_device_get_match_data(&pdev->dev);
@@ -1367,16 +1366,13 @@ static int tegra_dma_probe(struct platform_device *pdev)
for (i = 0; i < cdata->nr_channels; i++) {
struct tegra_dma_channel *tdc = &tdma->channels[i];
+ tdc->irq = platform_get_irq(pdev, i);
+ if (tdc->irq < 0)
+ return tdc->irq;
+
tdc->chan_base_offset = TEGRA_GPCDMA_CHANNEL_BASE_ADD_OFFSET +
i * cdata->channel_reg_size;
- res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
- if (!res) {
- dev_err(&pdev->dev, "No irq resource for chan %d\n", i);
- return -EINVAL;
- }
- tdc->irq = res->start;
snprintf(tdc->name, sizeof(tdc->name), "gpcdma.%d", i);
-
tdc->tdma = tdma;
tdc->id = i;
tdc->slave_id = -1;