1 From 1c67d6e7cc30a856e79664e0be3a1f705bad56e4 Mon Sep 17 00:00:00 2001
2 From: Grant Likely <grant.likely@linaro.org>
3 Date: Thu, 19 Dec 2013 09:31:01 -0300
4 Subject: [PATCH 190/203] of/irq: Fix bug in interrupt parsing refactor.
6 Commit 2361613206e6, "of/irq: Refactor interrupt-map parsing" introduced
7 a bug. The irq parsing will fail for some nodes that don't have a reg
8 property. It is fixed by deferring the check for reg until it is
9 actually needed. Also adjust the testcase data to catch the bug.
11 Signed-off-by: Grant Likely <grant.likely@linaro.org>
12 Tested-by: Stephen Warren <swarren@nvidia.com>
13 Tested-by: Ming Lei <tom.leiming@gmail.com>
14 Tested-by: Stephen Warren <swarren@nvidia.com>
15 Cc: Rob Herring <rob.herring@calxeda.com>
18 arch/arm/boot/dts/testcases/tests-interrupts.dtsi
20 drivers/of/irq.c | 20 ++++++++++----------
21 1 file changed, 10 insertions(+), 10 deletions(-)
23 --- a/drivers/of/irq.c
24 +++ b/drivers/of/irq.c
25 @@ -147,18 +147,9 @@ int of_irq_parse_raw(const __be32 *addr,
27 pr_debug(" -> addrsize=%d\n", addrsize);
29 - /* If we were passed no "reg" property and we attempt to parse
30 - * an interrupt-map, then #address-cells must be 0.
33 - if (addr == NULL && addrsize != 0) {
34 - pr_debug(" -> no reg passed in when needed !\n");
38 /* Precalculate the match array - this simplifies match loop */
39 for (i = 0; i < addrsize; i++)
40 - initial_match_array[i] = addr[i];
41 + initial_match_array[i] = addr ? addr[i] : 0;
42 for (i = 0; i < intsize; i++)
43 initial_match_array[addrsize + i] = cpu_to_be32(out_irq->args[i]);
45 @@ -174,6 +165,15 @@ int of_irq_parse_raw(const __be32 *addr,
50 + * interrupt-map parsing does not work without a reg
51 + * property when #address-cells != 0
53 + if (addrsize && !addr) {
54 + pr_debug(" -> no reg passed in when needed !\n");
58 /* Now look for an interrupt-map */
59 imap = of_get_property(ipar, "interrupt-map", &imaplen);
60 /* No interrupt map, check for an interrupt parent */