diff mbox series

[9/9] memory: omap-gpmc: switch to platform_get_irq

Message ID 20191222185034.4665-9-tiny.windzz@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/9] memory: emif: convert to devm_platform_ioremap_resource | expand

Commit Message

Yangtao Li Dec. 22, 2019, 6:50 p.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: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/memory/omap-gpmc.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Roger Quadros Dec. 23, 2019, 7:25 a.m. UTC | #1
On 22/12/2019 20:50, Yangtao Li 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: Yangtao Li <tiny.windzz@gmail.com>

Acked-by: Roger Quadros <rogerq@ti.com>

> ---
>   drivers/memory/omap-gpmc.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index eff26c1b1394..6dd19d168f75 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -2366,13 +2366,9 @@ static int gpmc_probe(struct platform_device *pdev)
>   	if (IS_ERR(gpmc_base))
>   		return PTR_ERR(gpmc_base);
>   
> -	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -	if (!res) {
> -		dev_err(&pdev->dev, "Failed to get resource: irq\n");
> -		return -ENOENT;
> -	}
> -
> -	gpmc->irq = res->start;
> +	gpmc->irq = platform_get_irq(pdev, 0);
> +	if (gpmc->irq < 0)
> +		return gpmc->irq;
>   
>   	gpmc_l3_clk = devm_clk_get(&pdev->dev, "fck");
>   	if (IS_ERR(gpmc_l3_clk)) {
>
diff mbox series

Patch

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index eff26c1b1394..6dd19d168f75 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2366,13 +2366,9 @@  static int gpmc_probe(struct platform_device *pdev)
 	if (IS_ERR(gpmc_base))
 		return PTR_ERR(gpmc_base);
 
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "Failed to get resource: irq\n");
-		return -ENOENT;
-	}
-
-	gpmc->irq = res->start;
+	gpmc->irq = platform_get_irq(pdev, 0);
+	if (gpmc->irq < 0)
+		return gpmc->irq;
 
 	gpmc_l3_clk = devm_clk_get(&pdev->dev, "fck");
 	if (IS_ERR(gpmc_l3_clk)) {