linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: stm32-dma: dmaengine: stm32-dma: use platform_get_irq()
@ 2019-04-24  9:21 Fabien Dessenne
  2019-04-24  9:27 ` Pierre Yves MORDRET
  2019-04-26 12:20 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Fabien Dessenne @ 2019-04-24  9:21 UTC (permalink / raw)
  To: Vinod Koul, Dan Williams, Maxime Coquelin, Alexandre Torgue,
	Pierre-Yves MORDRET, dmaengine, linux-stm32, linux-arm-kernel,
	linux-kernel
  Cc: Fabien Dessenne

platform_get_resource(pdev, IORESOURCE_IRQ) is not recommended for
requesting IRQ's resources, as they can be not ready yet. Using
platform_get_irq() instead is preferred for getting IRQ even if it was
not retrieved earlier.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/dma/stm32-dma.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
index ba239b5..3306818 100644
--- a/drivers/dma/stm32-dma.c
+++ b/drivers/dma/stm32-dma.c
@@ -1302,13 +1302,14 @@ static int stm32_dma_probe(struct platform_device *pdev)
 
 	for (i = 0; i < STM32_DMA_MAX_CHANNELS; i++) {
 		chan = &dmadev->chan[i];
-		res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
-		if (!res) {
-			ret = -EINVAL;
-			dev_err(&pdev->dev, "No irq resource for chan %d\n", i);
+		chan->irq = platform_get_irq(pdev, i);
+		if (chan->irq < 0)  {
+			ret = chan->irq;
+			if (ret != -EPROBE_DEFER)
+				dev_err(&pdev->dev,
+					"No irq resource for chan %d\n", i);
 			goto err_unregister;
 		}
-		chan->irq = res->start;
 		ret = devm_request_irq(&pdev->dev, chan->irq,
 				       stm32_dma_chan_irq, 0,
 				       dev_name(chan2dev(chan)), chan);
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] dmaengine: stm32-dma: dmaengine: stm32-dma: use platform_get_irq()
  2019-04-24  9:21 [PATCH] dmaengine: stm32-dma: dmaengine: stm32-dma: use platform_get_irq() Fabien Dessenne
@ 2019-04-24  9:27 ` Pierre Yves MORDRET
  2019-04-26 12:20 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre Yves MORDRET @ 2019-04-24  9:27 UTC (permalink / raw)
  To: Fabien Dessenne, Vinod Koul, Dan Williams, Maxime Coquelin,
	Alexandre Torgue, dmaengine, linux-stm32, linux-arm-kernel,
	linux-kernel

Hello

Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>

Thanks

On 4/24/19 11:21 AM, Fabien Dessenne wrote:
> platform_get_resource(pdev, IORESOURCE_IRQ) is not recommended for
> requesting IRQ's resources, as they can be not ready yet. Using
> platform_get_irq() instead is preferred for getting IRQ even if it was
> not retrieved earlier.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
>  drivers/dma/stm32-dma.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
> index ba239b5..3306818 100644
> --- a/drivers/dma/stm32-dma.c
> +++ b/drivers/dma/stm32-dma.c
> @@ -1302,13 +1302,14 @@ static int stm32_dma_probe(struct platform_device *pdev)
>  
>  	for (i = 0; i < STM32_DMA_MAX_CHANNELS; i++) {
>  		chan = &dmadev->chan[i];
> -		res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
> -		if (!res) {
> -			ret = -EINVAL;
> -			dev_err(&pdev->dev, "No irq resource for chan %d\n", i);
> +		chan->irq = platform_get_irq(pdev, i);
> +		if (chan->irq < 0)  {
> +			ret = chan->irq;
> +			if (ret != -EPROBE_DEFER)
> +				dev_err(&pdev->dev,
> +					"No irq resource for chan %d\n", i);
>  			goto err_unregister;
>  		}
> -		chan->irq = res->start;
>  		ret = devm_request_irq(&pdev->dev, chan->irq,
>  				       stm32_dma_chan_irq, 0,
>  				       dev_name(chan2dev(chan)), chan);
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] dmaengine: stm32-dma: dmaengine: stm32-dma: use platform_get_irq()
  2019-04-24  9:21 [PATCH] dmaengine: stm32-dma: dmaengine: stm32-dma: use platform_get_irq() Fabien Dessenne
  2019-04-24  9:27 ` Pierre Yves MORDRET
@ 2019-04-26 12:20 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2019-04-26 12:20 UTC (permalink / raw)
  To: Fabien Dessenne
  Cc: Alexandre Torgue, linux-kernel, Pierre-Yves MORDRET,
	Maxime Coquelin, dmaengine, Dan Williams, linux-stm32,
	linux-arm-kernel

On 24-04-19, 11:21, Fabien Dessenne wrote:
> platform_get_resource(pdev, IORESOURCE_IRQ) is not recommended for
> requesting IRQ's resources, as they can be not ready yet. Using
> platform_get_irq() instead is preferred for getting IRQ even if it was
> not retrieved earlier.

Applied, thanks

-- 
~Vinod

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-04-26 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24  9:21 [PATCH] dmaengine: stm32-dma: dmaengine: stm32-dma: use platform_get_irq() Fabien Dessenne
2019-04-24  9:27 ` Pierre Yves MORDRET
2019-04-26 12:20 ` 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).