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
6 This patch extends the DT selftest code with some test cases for the
7 interrupt parsing functions.
9 Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
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
18 +++ b/arch/arm/boot/dts/testcases/tests-interrupts.dtsi
24 + #address-cells = <0>;
26 + interrupt-controller;
27 + #interrupt-cells = <1>;
31 + interrupt-controller;
32 + #interrupt-cells = <3>;
36 + interrupt-controller;
37 + #interrupt-cells = <2>;
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>;
50 + interrupt-parent = <&test_intc0>;
51 + interrupts = <1>, <2>, <3>, <4>;
55 + interrupt-parent = <&test_intmap0>;
56 + interrupts = <1>, <2>, <3>, <4>;
61 --- a/arch/arm/boot/dts/testcases/tests.dtsi
62 +++ b/arch/arm/boot/dts/testcases/tests.dtsi
64 /include/ "tests-phandle.dtsi"
65 +/include/ "tests-interrupts.dtsi"
66 --- a/drivers/of/selftest.c
67 +++ b/drivers/of/selftest.c
69 #include <linux/errno.h>
70 #include <linux/module.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>
78 -static bool selftest_passed = true;
79 +static struct selftest_results {
84 #define selftest(result, fmt, ...) { \
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__); \
91 - pr_info("pass %s:%i\n", __FILE__, __LINE__); \
92 + selftest_results.passed++; \
93 + pr_debug("pass %s():%i\n", __func__, __LINE__); \
97 @@ -131,7 +137,6 @@ static void __init of_selftest_property_
98 struct device_node *np;
101 - pr_info("start\n");
102 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
104 pr_err("No testcase data in device tree\n");