dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: tegra: Use platform_get_irq() to get IRQ resource
@ 2022-05-05  9:14 Akhil R
  2022-05-05  9:18 ` Jon Hunter
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Akhil R @ 2022-05-05  9:14 UTC (permalink / raw)
  To: dmaengine, jonathanh, ldewangan, linux-kernel, linux-tegra,
	p.zabel, thierry.reding, vkoul
  Cc: akhilrajeev

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>
---
 drivers/dma/tegra186-gpc-dma.c | 12 ++++--------
 1 file 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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] dmaengine: tegra: Use platform_get_irq() to get IRQ resource
  2022-05-05  9:14 [PATCH] dmaengine: tegra: Use platform_get_irq() to get IRQ resource Akhil R
@ 2022-05-05  9:18 ` Jon Hunter
  2022-05-16  8:42   ` Jon Hunter
  2022-05-05 13:38 ` Thierry Reding
  2022-05-16 11:29 ` Vinod Koul
  2 siblings, 1 reply; 5+ messages in thread
From: Jon Hunter @ 2022-05-05  9:18 UTC (permalink / raw)
  To: Akhil R, dmaengine, ldewangan, linux-kernel, linux-tegra,
	p.zabel, thierry.reding, vkoul


On 05/05/2022 10:14, Akhil R wrote:
> 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>
> ---
>   drivers/dma/tegra186-gpc-dma.c | 12 ++++--------
>   1 file 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;


Thanks!

Reviewed-by: Jon Hunter <jonathanh@nvidia.com>

Jon

-- 
nvpublic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dmaengine: tegra: Use platform_get_irq() to get IRQ resource
  2022-05-05  9:14 [PATCH] dmaengine: tegra: Use platform_get_irq() to get IRQ resource Akhil R
  2022-05-05  9:18 ` Jon Hunter
@ 2022-05-05 13:38 ` Thierry Reding
  2022-05-16 11:29 ` Vinod Koul
  2 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2022-05-05 13:38 UTC (permalink / raw)
  To: Akhil R
  Cc: dmaengine, jonathanh, ldewangan, linux-kernel, linux-tegra,
	p.zabel, vkoul

[-- Attachment #1: Type: text/plain, Size: 758 bytes --]

On Thu, May 05, 2022 at 02:44:40PM +0530, Akhil R wrote:
> 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>
> ---
>  drivers/dma/tegra186-gpc-dma.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dmaengine: tegra: Use platform_get_irq() to get IRQ resource
  2022-05-05  9:18 ` Jon Hunter
@ 2022-05-16  8:42   ` Jon Hunter
  0 siblings, 0 replies; 5+ messages in thread
From: Jon Hunter @ 2022-05-16  8:42 UTC (permalink / raw)
  To: Akhil R, dmaengine, ldewangan, linux-kernel, linux-tegra,
	p.zabel, thierry.reding, vkoul

Vinod,

On 05/05/2022 10:18, Jon Hunter wrote:
> 
> On 05/05/2022 10:14, Akhil R wrote:
>> 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>
>> ---
>>   drivers/dma/tegra186-gpc-dma.c | 12 ++++--------
>>   1 file 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;
> 
> 
> Thanks!
> 
> Reviewed-by: Jon Hunter <jonathanh@nvidia.com>


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

Jon

-- 
nvpublic

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dmaengine: tegra: Use platform_get_irq() to get IRQ resource
  2022-05-05  9:14 [PATCH] dmaengine: tegra: Use platform_get_irq() to get IRQ resource Akhil R
  2022-05-05  9:18 ` Jon Hunter
  2022-05-05 13:38 ` Thierry Reding
@ 2022-05-16 11:29 ` Vinod Koul
  2 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2022-05-16 11:29 UTC (permalink / raw)
  To: Akhil R
  Cc: dmaengine, jonathanh, ldewangan, linux-kernel, linux-tegra,
	p.zabel, thierry.reding

On 05-05-22, 14:44, Akhil R wrote:
> 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

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-16 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-05  9:14 [PATCH] dmaengine: tegra: Use platform_get_irq() to get IRQ resource Akhil R
2022-05-05  9:18 ` Jon Hunter
2022-05-16  8:42   ` Jon Hunter
2022-05-05 13:38 ` Thierry Reding
2022-05-16 11:29 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).