diff options
author | Grant Likely <grant.likely@linaro.org> | 2014-10-03 11:28:27 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-11-04 08:29:38 -0500 |
commit | 5063e25a302e6a83f6590d9a06bd5f6400b17430 (patch) | |
tree | bd6aafd28fb65ea19cd1535fd9a53263b42a68c0 /Documentation/devicetree/of_selftest.txt | |
parent | e7a00e4210e4cc980e3ba67ec7301af54061d14b (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.txt | 20 |
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 | |||
99 | Figure 1: Generic structure of un-flattened device tree | 98 | Figure 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 | |||
105 | root->child1->child11->sibling12->sibling13->child131->sibling14->sibling2-> | ||
106 | child21->sibling22->sibling23->sibling3->child31->sibling32->sibling4->null | ||
107 | |||
108 | Before executing OF selftest, it is required to attach the test data to | 101 | Before executing OF selftest, it is required to attach the test data to |
109 | machine's device tree (if present). So, when selftest_data_add() is called, | 102 | machine's device tree (if present). So, when selftest_data_add() is called, |
110 | at first it reads the flattened device tree data linked into the kernel image | 103 | at 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 | ||
134 | allnext list: | ||
135 | |||
136 | root->testcase-data->test-child0->test-child01->test-sibling1->test-sibling2 | ||
137 | ->test-sibling3->null | ||
138 | |||
139 | Figure 2: Example test data tree to be attached to live tree. | 127 | Figure 2: Example test data tree to be attached to live tree. |
140 | 128 | ||
141 | According to the scenario above, the live tree is already present so it isn't | 129 | According 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 | |||
204 | whole tree). selftest_data_remove() calls detach_node_and_children() that uses | 192 | whole tree). selftest_data_remove() calls detach_node_and_children() that uses |
205 | of_detach_node() to detach the nodes from the live device tree. | 193 | of_detach_node() to detach the nodes from the live device tree. |
206 | 194 | ||
207 | To detach a node, of_detach_node() first updates all_next linked list, by | 195 | To detach a node, of_detach_node() either updates the child pointer of given |
208 | attaching the previous node's allnext to current node's allnext pointer. And | 196 | node's parent to its sibling or attaches the previous sibling to the given |
209 | then, it either updates the child pointer of given node's parent to its | 197 | node's sibling, as appropriate. That is it :) |
210 | sibling or attaches the previous sibling to the given node's sibling, as | ||
211 | appropriate. That is it :) | ||