base-files: define yes/no as valid boolean options
[openwrt.git] / target / linux / mvebu / patches-3.10 / 0190-of-irq-Fix-bug-in-interrupt-parsing-refactor.patch
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.
5
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.
10
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>
16
17 Conflicts:
18         arch/arm/boot/dts/testcases/tests-interrupts.dtsi
19 ---
20  drivers/of/irq.c | 20 ++++++++++----------
21  1 file changed, 10 insertions(+), 10 deletions(-)
22
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,
26  
27         pr_debug(" -> addrsize=%d\n", addrsize);
28  
29 -       /* If we were passed no "reg" property and we attempt to parse
30 -        * an interrupt-map, then #address-cells must be 0.
31 -        * Fail if it's not.
32 -        */
33 -       if (addr == NULL && addrsize != 0) {
34 -               pr_debug(" -> no reg passed in when needed !\n");
35 -               return -EINVAL;
36 -       }
37 -
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]);
44  
45 @@ -174,6 +165,15 @@ int of_irq_parse_raw(const __be32 *addr,
46                         return 0;
47                 }
48  
49 +               /*
50 +                * interrupt-map parsing does not work without a reg
51 +                * property when #address-cells != 0
52 +                */
53 +               if (addrsize && !addr) {
54 +                       pr_debug(" -> no reg passed in when needed !\n");
55 +                       goto fail;
56 +               }
57 +
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 */