i2c: bcm2835: Use platform_get_irq() to get the interrupt
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Tue, 21 Dec 2021 17:53:20 +0000 (17:53 +0000)
committerWolfram Sang <wsa@kernel.org>
Mon, 3 Jan 2022 09:17:14 +0000 (10:17 +0100)
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-bcm2835.c

index 37443edbf75464083693878983790c93d3457709..dfc534065595f2304529af708b379434db595266 100644 (file)
@@ -402,7 +402,7 @@ static const struct i2c_adapter_quirks bcm2835_i2c_quirks = {
 static int bcm2835_i2c_probe(struct platform_device *pdev)
 {
        struct bcm2835_i2c_dev *i2c_dev;
-       struct resource *mem, *irq;
+       struct resource *mem;
        int ret;
        struct i2c_adapter *adap;
        struct clk *mclk;
@@ -452,12 +452,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
                return ret;
        }
 
-       irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-       if (!irq) {
-               dev_err(&pdev->dev, "No IRQ resource\n");
-               return -ENODEV;
-       }
-       i2c_dev->irq = irq->start;
+       i2c_dev->irq = platform_get_irq(pdev, 0);
+       if (i2c_dev->irq < 0)
+               return i2c_dev->irq;
 
        ret = request_irq(i2c_dev->irq, bcm2835_i2c_isr, IRQF_SHARED,
                          dev_name(&pdev->dev), i2c_dev);