aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/of_selftest.txt
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-10-03 11:28:27 -0400
committerGrant Likely <grant.likely@linaro.org>2014-11-04 08:29:38 -0500
commit5063e25a302e6a83f6590d9a06bd5f6400b17430 (patch)
treebd6aafd28fb65ea19cd1535fd9a53263b42a68c0 /Documentation/devicetree/of_selftest.txt
parente7a00e4210e4cc980e3ba67ec7301af54061d14b (diff)
of: Eliminate of_allnodes list
The device tree structure is composed of two lists; the 'allnodes' list which is a singly linked list containing every node in the tree, and the child->parent structure where each parent node has a singly linked list of children. All of the data in the allnodes list can be easily reproduced with the parent-child lists, so of_allnodes is actually unnecessary. Remove it entirely which saves a bit of memory and simplifies the data structure quite a lot. Signed-off-by: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <robh@kernel.org> Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com> Cc: Pantelis Antoniou <pantelis@pantelis.antoniou@konsulko.com>
Diffstat (limited to 'Documentation/devicetree/of_selftest.txt')
-rw-r--r--Documentation/devicetree/of_selftest.txt20
1 files changed, 3 insertions, 17 deletions
diff --git a/Documentation/devicetree/of_selftest.txt b/Documentation/devicetree/of_selftest.txt
index 1e3d5c92b5e3..57a808b588bf 100644
--- a/Documentation/devicetree/of_selftest.txt
+++ b/Documentation/devicetree/of_selftest.txt
@@ -63,7 +63,6 @@ struct device_node {
63 struct device_node *parent; 63 struct device_node *parent;
64 struct device_node *child; 64 struct device_node *child;
65 struct device_node *sibling; 65 struct device_node *sibling;
66 struct device_node *allnext; /* next in list of all nodes */
67 ... 66 ...
68 }; 67 };
69 68
@@ -99,12 +98,6 @@ child11 -> sibling12 -> sibling13 -> sibling14 -> null
99Figure 1: Generic structure of un-flattened device tree 98Figure 1: Generic structure of un-flattened device tree
100 99
101 100
102*allnext: it is used to link all the nodes of DT into a list. So, for the
103 above tree the list would be as follows:
104
105root->child1->child11->sibling12->sibling13->child131->sibling14->sibling2->
106child21->sibling22->sibling23->sibling3->child31->sibling32->sibling4->null
107
108Before executing OF selftest, it is required to attach the test data to 101Before executing OF selftest, it is required to attach the test data to
109machine's device tree (if present). So, when selftest_data_add() is called, 102machine's device tree (if present). So, when selftest_data_add() is called,
110at first it reads the flattened device tree data linked into the kernel image 103at first it reads the flattened device tree data linked into the kernel image
@@ -131,11 +124,6 @@ root ('/')
131 test-child01 null null null 124 test-child01 null null null
132 125
133 126
134allnext list:
135
136root->testcase-data->test-child0->test-child01->test-sibling1->test-sibling2
137->test-sibling3->null
138
139Figure 2: Example test data tree to be attached to live tree. 127Figure 2: Example test data tree to be attached to live tree.
140 128
141According to the scenario above, the live tree is already present so it isn't 129According to the scenario above, the live tree is already present so it isn't
@@ -204,8 +192,6 @@ detached and then moving up the parent nodes are removed, and eventually the
204whole tree). selftest_data_remove() calls detach_node_and_children() that uses 192whole tree). selftest_data_remove() calls detach_node_and_children() that uses
205of_detach_node() to detach the nodes from the live device tree. 193of_detach_node() to detach the nodes from the live device tree.
206 194
207To detach a node, of_detach_node() first updates all_next linked list, by 195To detach a node, of_detach_node() either updates the child pointer of given
208attaching the previous node's allnext to current node's allnext pointer. And 196node's parent to its sibling or attaches the previous sibling to the given
209then, it either updates the child pointer of given node's parent to its 197node's sibling, as appropriate. That is it :)
210sibling or attaches the previous sibling to the given node's sibling, as
211appropriate. That is it :)