base-files: define yes/no as valid boolean options
[openwrt/staging/mkresin.git] / target / linux / mvebu / patches-3.10 / 0198-of-Add-testcases-for-interrupt-parsing.patch
1 From 39623dc5cb8814223e9580e22e78dfab10d91783 Mon Sep 17 00:00:00 2001
2 From: Grant Likely <grant.likely@linaro.org>
3 Date: Tue, 24 Dec 2013 11:36:02 +0100
4 Subject: [PATCH 198/203] of: Add testcases for interrupt parsing
5
6 This patch extends the DT selftest code with some test cases for the
7 interrupt parsing functions.
8
9 Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
10 ---
11 arch/arm/boot/dts/testcases/tests-interrupts.dtsi | 41 +++++++++++++++++++++++
12 arch/arm/boot/dts/testcases/tests.dtsi | 1 +
13 drivers/of/selftest.c | 15 ++++++---
14 3 files changed, 52 insertions(+), 5 deletions(-)
15 create mode 100644 arch/arm/boot/dts/testcases/tests-interrupts.dtsi
16
17 --- /dev/null
18 +++ b/arch/arm/boot/dts/testcases/tests-interrupts.dtsi
19 @@ -0,0 +1,41 @@
20 +
21 +/ {
22 + testcase-data {
23 + interrupts {
24 + #address-cells = <0>;
25 + test_intc0: intc0 {
26 + interrupt-controller;
27 + #interrupt-cells = <1>;
28 + };
29 +
30 + test_intc1: intc1 {
31 + interrupt-controller;
32 + #interrupt-cells = <3>;
33 + };
34 +
35 + test_intc2: intc2 {
36 + interrupt-controller;
37 + #interrupt-cells = <2>;
38 + };
39 +
40 + test_intmap0: intmap0 {
41 + #interrupt-cells = <1>;
42 + #address-cells = <0>;
43 + interrupt-map = <1 &test_intc0 9>,
44 + <2 &test_intc1 10 11 12>,
45 + <3 &test_intc2 13 14>,
46 + <4 &test_intc2 15 16>;
47 + };
48 +
49 + interrupts0 {
50 + interrupt-parent = <&test_intc0>;
51 + interrupts = <1>, <2>, <3>, <4>;
52 + };
53 +
54 + interrupts1 {
55 + interrupt-parent = <&test_intmap0>;
56 + interrupts = <1>, <2>, <3>, <4>;
57 + };
58 + };
59 + };
60 +};
61 --- a/arch/arm/boot/dts/testcases/tests.dtsi
62 +++ b/arch/arm/boot/dts/testcases/tests.dtsi
63 @@ -1 +1,2 @@
64 /include/ "tests-phandle.dtsi"
65 +/include/ "tests-interrupts.dtsi"
66 --- a/drivers/of/selftest.c
67 +++ b/drivers/of/selftest.c
68 @@ -9,18 +9,24 @@
69 #include <linux/errno.h>
70 #include <linux/module.h>
71 #include <linux/of.h>
72 +#include <linux/of_irq.h>
73 #include <linux/list.h>
74 #include <linux/mutex.h>
75 #include <linux/slab.h>
76 #include <linux/device.h>
77
78 -static bool selftest_passed = true;
79 +static struct selftest_results {
80 + int passed;
81 + int failed;
82 +} selftest_results;
83 +
84 #define selftest(result, fmt, ...) { \
85 if (!(result)) { \
86 - pr_err("FAIL %s:%i " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
87 - selftest_passed = false; \
88 + selftest_results.failed++; \
89 + pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); \
90 } else { \
91 - pr_info("pass %s:%i\n", __FILE__, __LINE__); \
92 + selftest_results.passed++; \
93 + pr_debug("pass %s():%i\n", __func__, __LINE__); \
94 } \
95 }
96
97 @@ -131,7 +137,6 @@ static void __init of_selftest_property_
98 struct device_node *np;
99 int rc;
100
101 - pr_info("start\n");
102 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
103 if (!np) {
104 pr_err("No testcase data in device tree\n");