105 lines
2.8 KiB
Diff
105 lines
2.8 KiB
Diff
|
From 39623dc5cb8814223e9580e22e78dfab10d91783 Mon Sep 17 00:00:00 2001
|
||
|
From: Grant Likely <grant.likely@linaro.org>
|
||
|
Date: Tue, 24 Dec 2013 11:36:02 +0100
|
||
|
Subject: [PATCH 198/203] of: Add testcases for interrupt parsing
|
||
|
|
||
|
This patch extends the DT selftest code with some test cases for the
|
||
|
interrupt parsing functions.
|
||
|
|
||
|
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
|
||
|
---
|
||
|
arch/arm/boot/dts/testcases/tests-interrupts.dtsi | 41 +++++++++++++++++++++++
|
||
|
arch/arm/boot/dts/testcases/tests.dtsi | 1 +
|
||
|
drivers/of/selftest.c | 15 ++++++---
|
||
|
3 files changed, 52 insertions(+), 5 deletions(-)
|
||
|
create mode 100644 arch/arm/boot/dts/testcases/tests-interrupts.dtsi
|
||
|
|
||
|
--- /dev/null
|
||
|
+++ b/arch/arm/boot/dts/testcases/tests-interrupts.dtsi
|
||
|
@@ -0,0 +1,41 @@
|
||
|
+
|
||
|
+/ {
|
||
|
+ testcase-data {
|
||
|
+ interrupts {
|
||
|
+ #address-cells = <0>;
|
||
|
+ test_intc0: intc0 {
|
||
|
+ interrupt-controller;
|
||
|
+ #interrupt-cells = <1>;
|
||
|
+ };
|
||
|
+
|
||
|
+ test_intc1: intc1 {
|
||
|
+ interrupt-controller;
|
||
|
+ #interrupt-cells = <3>;
|
||
|
+ };
|
||
|
+
|
||
|
+ test_intc2: intc2 {
|
||
|
+ interrupt-controller;
|
||
|
+ #interrupt-cells = <2>;
|
||
|
+ };
|
||
|
+
|
||
|
+ test_intmap0: intmap0 {
|
||
|
+ #interrupt-cells = <1>;
|
||
|
+ #address-cells = <0>;
|
||
|
+ interrupt-map = <1 &test_intc0 9>,
|
||
|
+ <2 &test_intc1 10 11 12>,
|
||
|
+ <3 &test_intc2 13 14>,
|
||
|
+ <4 &test_intc2 15 16>;
|
||
|
+ };
|
||
|
+
|
||
|
+ interrupts0 {
|
||
|
+ interrupt-parent = <&test_intc0>;
|
||
|
+ interrupts = <1>, <2>, <3>, <4>;
|
||
|
+ };
|
||
|
+
|
||
|
+ interrupts1 {
|
||
|
+ interrupt-parent = <&test_intmap0>;
|
||
|
+ interrupts = <1>, <2>, <3>, <4>;
|
||
|
+ };
|
||
|
+ };
|
||
|
+ };
|
||
|
+};
|
||
|
--- a/arch/arm/boot/dts/testcases/tests.dtsi
|
||
|
+++ b/arch/arm/boot/dts/testcases/tests.dtsi
|
||
|
@@ -1 +1,2 @@
|
||
|
/include/ "tests-phandle.dtsi"
|
||
|
+/include/ "tests-interrupts.dtsi"
|
||
|
--- a/drivers/of/selftest.c
|
||
|
+++ b/drivers/of/selftest.c
|
||
|
@@ -9,18 +9,24 @@
|
||
|
#include <linux/errno.h>
|
||
|
#include <linux/module.h>
|
||
|
#include <linux/of.h>
|
||
|
+#include <linux/of_irq.h>
|
||
|
#include <linux/list.h>
|
||
|
#include <linux/mutex.h>
|
||
|
#include <linux/slab.h>
|
||
|
#include <linux/device.h>
|
||
|
|
||
|
-static bool selftest_passed = true;
|
||
|
+static struct selftest_results {
|
||
|
+ int passed;
|
||
|
+ int failed;
|
||
|
+} selftest_results;
|
||
|
+
|
||
|
#define selftest(result, fmt, ...) { \
|
||
|
if (!(result)) { \
|
||
|
- pr_err("FAIL %s:%i " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
|
||
|
- selftest_passed = false; \
|
||
|
+ selftest_results.failed++; \
|
||
|
+ pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); \
|
||
|
} else { \
|
||
|
- pr_info("pass %s:%i\n", __FILE__, __LINE__); \
|
||
|
+ selftest_results.passed++; \
|
||
|
+ pr_debug("pass %s():%i\n", __func__, __LINE__); \
|
||
|
} \
|
||
|
}
|
||
|
|
||
|
@@ -131,7 +137,6 @@ static void __init of_selftest_property_
|
||
|
struct device_node *np;
|
||
|
int rc;
|
||
|
|
||
|
- pr_info("start\n");
|
||
|
np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
|
||
|
if (!np) {
|
||
|
pr_err("No testcase data in device tree\n");
|