All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] of/irq: lookup 'interrupts-extended' property first
@ 2014-08-06 20:02 Florian Fainelli
  2014-08-06 20:15   ` Brian Norris
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2014-08-06 20:02 UTC (permalink / raw)
  To: devicetree
  Cc: grant.likely, robh+dt, linux-kernel, Florian Fainelli, Brian Norris

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 conveys a lot more information.

This allows us to have bootloaders willingly maintaining backwards
compatibility with older kernels without entirely deprecating the
'interrupts' property.

Update the bindings documentation to describe a situation where both the
'interrupts-extended' and the 'interrupts' property are present, and
which one takes precedence over the other.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
- added Brian's update to the binding
- added Rob's hack based on the initial patch
- slightly reworked the comment about drivers/of/irq.c to specify which
  property we look up first

 .../bindings/interrupt-controller/interrupts.txt        | 12 +++++++-----
 drivers/of/irq.c                                        | 17 +++++++++--------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
index 1486497a24c1..ce6a1a072028 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
@@ -4,11 +4,13 @@ Specifying interrupt information for devices
 1) Interrupt client nodes
 -------------------------
 
-Nodes that describe devices which generate interrupts must contain an either an
-"interrupts" property or an "interrupts-extended" property. These properties
-contain a list of interrupt specifiers, one per output interrupt. The format of
-the interrupt specifier is determined by the interrupt controller to which the
-interrupts are routed; see section 2 below for details.
+Nodes that describe devices which generate interrupts must contain an
+"interrupts" property, an "interrupts-extended" property, or both. If both are
+present, the latter should take precedence; the former may be provided simply
+for compatibility with software that does not recognize the latter. These
+properties contain a list of interrupt specifiers, one per output interrupt. The
+format of the interrupt specifier is determined by the interrupt controller to
+which the interrupts are routed; see section 2 below for details.
 
   Example:
 	interrupt-parent = <&intc1>;
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 3e06a699352d..1471e0a223a5 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 first */
+	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] 4+ messages in thread

* Re: [PATCH v2] of/irq: lookup 'interrupts-extended' property first
@ 2014-08-06 20:15   ` Brian Norris
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2014-08-06 20:15 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: devicetree, grant.likely, robh+dt, linux-kernel

On Wed, Aug 06, 2014 at 01:02:27PM -0700, Florian Fainelli wrote:
> 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 conveys a lot more information.
> 
> This allows us to have bootloaders willingly maintaining backwards
> compatibility with older kernels without entirely deprecating the
> 'interrupts' property.
> 
> Update the bindings documentation to describe a situation where both the
> 'interrupts-extended' and the 'interrupts' property are present, and
> which one takes precedence over the other.
> 
> Acked-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Might we add this?

Cc: <stable@vger.kernel.org> # 3.13+

Brian

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

* Re: [PATCH v2] of/irq: lookup 'interrupts-extended' property first
@ 2014-08-06 20:15   ` Brian Norris
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2014-08-06 20:15 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, Aug 06, 2014 at 01:02:27PM -0700, Florian Fainelli wrote:
> 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 conveys a lot more information.
> 
> This allows us to have bootloaders willingly maintaining backwards
> compatibility with older kernels without entirely deprecating the
> 'interrupts' property.
> 
> Update the bindings documentation to describe a situation where both the
> 'interrupts-extended' and the 'interrupts' property are present, and
> which one takes precedence over the other.
> 
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Signed-off-by: Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Might we add this?

Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # 3.13+

Brian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] of/irq: lookup 'interrupts-extended' property first
  2014-08-06 20:15   ` Brian Norris
  (?)
@ 2014-08-15 12:51   ` Grant Likely
  -1 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2014-08-15 12:51 UTC (permalink / raw)
  To: Brian Norris, Florian Fainelli; +Cc: devicetree, robh+dt, linux-kernel

On Wed, 6 Aug 2014 13:15:00 -0700, Brian Norris <computersforpeace@gmail.com> wrote:
> On Wed, Aug 06, 2014 at 01:02:27PM -0700, Florian Fainelli wrote:
> > 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 conveys a lot more information.
> > 
> > This allows us to have bootloaders willingly maintaining backwards
> > compatibility with older kernels without entirely deprecating the
> > 'interrupts' property.
> > 
> > Update the bindings documentation to describe a situation where both the
> > 'interrupts-extended' and the 'interrupts' property are present, and
> > which one takes precedence over the other.
> > 
> > Acked-by: Rob Herring <robh@kernel.org>
> > Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> Might we add this?
> 
> Cc: <stable@vger.kernel.org> # 3.13+
> 
> Brian

Applied, thanks.

g.


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06 20:02 [PATCH v2] of/irq: lookup 'interrupts-extended' property first Florian Fainelli
2014-08-06 20:15 ` Brian Norris
2014-08-06 20:15   ` Brian Norris
2014-08-15 12:51   ` Grant Likely

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.