Skip to contentSkip to conversation

dmaengine: tegra: Use platform_get_irq() to get IRQ resource

PATCH Applied Akhil R 4 participants 5 messages May 5, 2022 – May 16, 2022

Subsystems (3)
lore
Share & tools
lore

Akhil R

author
#0 lore raw

PATCH 1/1 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")
---
 drivers/dma/tegra186-gpc-dma.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/dma/tegra186-gpc-dma.c +4 -8
index 97fe0e9e9b83..3951db527dec 100644
@@ -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;
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 38 lines · Akhil R

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")
---
  drivers/dma/tegra186-gpc-dma.c | 12 ++++--------
  1 file changed, 4 insertions(+), 8 deletions(-)
drivers/dma/tegra186-gpc-dma.c +4 -2
index 97fe0e9e9b83..3951db527dec 100644
@@ -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);

drivers/dma/tegra186-gpc-dma.c static int tegra_dma_probe(struct platform_device *pdev) · line 1378

Quoted 10 lines
drivers/dma/tegra186-gpc-dma.c +0 -6
-		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;

Thanks!

Jon

Signature · 1 line
nvpublic
maintainer
#2 lore raw

Vinod,

Quoted 54 lines · Jon Hunter
Quoted 40 lines · Akhil R

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")

---
  drivers/dma/tegra186-gpc-dma.c | 12 ++++--------

  1 file changed, 4 insertions(+), 8 deletions(-)
drivers/dma/tegra186-gpc-dma.c +4 -1
index 97fe0e9e9b83..3951db527dec 100644
@@ -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);

Quoted 8 lines

-            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;

Thanks!

Quoted 1 line

OK to pick this up for -next/5.19? This is preventing the GPC DMA driver from working.

Jon

Signature · 1 line
nvpublic
Acked-by on v1 1/1
#3 lore raw
In reply to Akhil R
Quoted 8 lines · Akhil R

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.

Quoted 6 lines
Fixes ee17028009d4 ("dmaengine: tegra: Add tegra gpcdma driver")
---
 drivers/dma/tegra186-gpc-dma.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
maintainer Applied
#4 lore raw
In reply to Akhil R
Quoted 7 lines · Akhil R

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.

Applied, thanks

Signature · 1 line
~Vinod