All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] of/irq: lookup 'interrupts-extended' property first
@ 2014-06-19 23:33 Florian Fainelli
  2014-07-31 18:00   ` Florian Fainelli
  0 siblings, 1 reply; 13+ messages in thread
From: Florian Fainelli @ 2014-06-19 23:33 UTC (permalink / raw)
  To: devicetree
  Cc: grant.likely, robh+dt, computersforpeace, linux-kernel, Florian Fainelli

In case the Device Tree blob passed by the boot agent supplies both an
'interrupts-extended' and an 'interrupts' property in order to allow for
older kernels to be usable, prefer the new-style 'interrupts-extended'
property which convey a lot more information.

This allows us to have bootloaders willingly maintaining backwards
compatibility with older kernels without entirely deprecating the
'interrupts' property (although that is a clear violation of the binding
specified at
Documentation/devicetree/bindings/interrupt-controller/interrupts.txt)

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/of/irq.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 3e06a699352d..1af3be2396db 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -301,16 +301,17 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
 	/* Get the reg property (if any) */
 	addr = of_get_property(device, "reg", NULL);
 
+	/* Try the new-style interrupts-extended */
+	res = of_parse_phandle_with_args(device, "interrupts-extended",
+					"#interrupt-cells", index, out_irq);
+	if (!res)
+		return of_irq_parse_raw(addr, out_irq);
+
 	/* Get the interrupts property */
 	intspec = of_get_property(device, "interrupts", &intlen);
-	if (intspec == NULL) {
-		/* Try the new-style interrupts-extended */
-		res = of_parse_phandle_with_args(device, "interrupts-extended",
-						"#interrupt-cells", index, out_irq);
-		if (res)
-			return -EINVAL;
-		return of_irq_parse_raw(addr, out_irq);
-	}
+	if (intspec == NULL)
+		return -EINVAL;
+
 	intlen /= sizeof(*intspec);
 
 	pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);
-- 
1.9.1


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

end of thread, other threads:[~2014-08-15 12:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-19 23:33 [PATCH] of/irq: lookup 'interrupts-extended' property first Florian Fainelli
2014-07-31 18:00 ` Florian Fainelli
2014-07-31 18:00   ` Florian Fainelli
2014-08-06 16:54   ` Brian Norris
2014-08-06 18:42     ` Rob Herring
2014-08-06 18:42       ` Rob Herring
2014-08-06 20:12       ` Brian Norris
2014-08-06 21:50         ` Tim Bird
2014-08-06 21:50           ` Tim Bird
2014-08-06 22:12           ` Florian Fainelli
2014-08-06 22:12             ` Florian Fainelli
2014-08-15 12:56             ` Grant Likely
2014-08-06 22:24           ` Rob Herring

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.