All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: bcm2835: Use platform_get_irq() to get the interrupt
@ 2022-02-10  9:25 ` zhaoxiao
  0 siblings, 0 replies; 4+ messages in thread
From: zhaoxiao @ 2022-02-10  9:25 UTC (permalink / raw)
  To: f.fainelli, rjui, sbranden, nsaenz
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-kernel, zhaoxiao

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 bypassed the hierarchical setup and messed 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: zhaoxiao <zhaoxiao@uniontech.com>
---
 drivers/i2c/busses/i2c-bcm2835.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 37443edbf754..dfc534065595 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -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);
-- 
2.20.1




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

* [PATCH] i2c: bcm2835: Use platform_get_irq() to get the interrupt
@ 2022-02-10  9:25 ` zhaoxiao
  0 siblings, 0 replies; 4+ messages in thread
From: zhaoxiao @ 2022-02-10  9:25 UTC (permalink / raw)
  To: f.fainelli, rjui, sbranden, nsaenz
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-kernel, zhaoxiao

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 bypassed the hierarchical setup and messed 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: zhaoxiao <zhaoxiao@uniontech.com>
---
 drivers/i2c/busses/i2c-bcm2835.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 37443edbf754..dfc534065595 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -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);
-- 
2.20.1




_______________________________________________
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] 4+ messages in thread

* Re: [PATCH] i2c: bcm2835: Use platform_get_irq() to get the interrupt
  2022-02-10  9:25 ` zhaoxiao
@ 2022-05-22 21:05   ` Wolfram Sang
  -1 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2022-05-22 21:05 UTC (permalink / raw)
  To: zhaoxiao
  Cc: f.fainelli, rjui, sbranden, nsaenz, linux-i2c, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel

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

On Thu, Feb 10, 2022 at 05:25:06PM +0800, zhaoxiao wrote:
> 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 bypassed the hierarchical setup and messed 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: zhaoxiao <zhaoxiao@uniontech.com>

Already fixed upstream 6 months ago with

c3b2f911ac11 ("i2c: bcm2835: Use platform_get_irq() to get the interrupt")



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

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

* Re: [PATCH] i2c: bcm2835: Use platform_get_irq() to get the interrupt
@ 2022-05-22 21:05   ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2022-05-22 21:05 UTC (permalink / raw)
  To: zhaoxiao
  Cc: f.fainelli, rjui, sbranden, nsaenz, linux-i2c, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 652 bytes --]

On Thu, Feb 10, 2022 at 05:25:06PM +0800, zhaoxiao wrote:
> 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 bypassed the hierarchical setup and messed 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: zhaoxiao <zhaoxiao@uniontech.com>

Already fixed upstream 6 months ago with

c3b2f911ac11 ("i2c: bcm2835: Use platform_get_irq() to get the interrupt")



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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2022-05-23  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10  9:25 [PATCH] i2c: bcm2835: Use platform_get_irq() to get the interrupt zhaoxiao
2022-02-10  9:25 ` zhaoxiao
2022-05-22 21:05 ` Wolfram Sang
2022-05-22 21:05   ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.