diff mbox series

dmaengine: stm32-dma: dmaengine: stm32-dma: use platform_get_irq()

Message ID 1556097685-7236-1-git-send-email-fabien.dessenne@st.com (mailing list archive)
State Mainlined, archived
Commit f4fd2ec08f17b34f1c7c18414d5fc882efd51e83
Headers show
Series dmaengine: stm32-dma: dmaengine: stm32-dma: use platform_get_irq() | expand

Commit Message

Fabien DESSENNE April 24, 2019, 9:21 a.m. UTC
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(-)

Comments

Pierre Yves MORDRET April 24, 2019, 9:27 a.m. UTC | #1
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);
>
Vinod Koul April 26, 2019, 12:20 p.m. UTC | #2
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
diff mbox series

Patch

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