of: Eliminate of_allnodes list
authorGrant Likely <grant.likely@linaro.org>
Fri, 3 Oct 2014 15:28:27 +0000 (16:28 +0100)
committerGrant Likely <grant.likely@linaro.org>
Tue, 4 Nov 2014 13:29:38 +0000 (13:29 +0000)
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>
Documentation/devicetree/of_selftest.txt
Documentation/devicetree/todo.txt
drivers/mfd/vexpress-sysreg.c
drivers/of/base.c
drivers/of/dynamic.c
drivers/of/fdt.c
drivers/of/pdt.c
drivers/of/selftest.c
include/linux/of.h
include/linux/of_pdt.h

index 1e3d5c9..57a808b 100644 (file)
@@ -63,7 +63,6 @@ struct device_node {
     struct  device_node *parent;
     struct  device_node *child;
     struct  device_node *sibling;
-    struct  device_node *allnext;   /* next in list of all nodes */
     ...
  };
 
@@ -99,12 +98,6 @@ child11 -> sibling12 -> sibling13 -> sibling14 -> null
 Figure 1: Generic structure of un-flattened device tree
 
 
-*allnext: it is used to link all the nodes of DT into a list. So, for the
- above tree the list would be as follows:
-
-root->child1->child11->sibling12->sibling13->child131->sibling14->sibling2->
-child21->sibling22->sibling23->sibling3->child31->sibling32->sibling4->null
-
 Before executing OF selftest, it is required to attach the test data to
 machine's device tree (if present). So, when selftest_data_add() is called,
 at first it reads the flattened device tree data linked into the kernel image
@@ -131,11 +124,6 @@ root ('/')
  test-child01      null             null             null
 
 
-allnext list:
-
-root->testcase-data->test-child0->test-child01->test-sibling1->test-sibling2
-->test-sibling3->null
-
 Figure 2: Example test data tree to be attached to live tree.
 
 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
 whole tree). selftest_data_remove() calls detach_node_and_children() that uses
 of_detach_node() to detach the nodes from the live device tree.
 
-To detach a node, of_detach_node() first updates all_next linked list, by
-attaching the previous node's allnext to current node's allnext pointer. And
-then, it either updates the child pointer of given node's parent to its
-sibling or attaches the previous sibling to the given node's sibling, as
-appropriate. That is it :)
+To detach a node, of_detach_node() either updates the child pointer of given
+node's parent to its sibling or attaches the previous sibling to the given
+node's sibling, as appropriate. That is it :)
index c3cf065..b5139d1 100644 (file)
@@ -2,7 +2,6 @@ Todo list for devicetree:
 
 === General structure ===
 - Switch from custom lists to (h)list_head for nodes and properties structure
-- Remove of_allnodes list and iterate using list of child nodes alone
 
 === CONFIG_OF_DYNAMIC ===
 - Switch to RCU for tree updates and get rid of global spinlock
index 9e21e4f..8f43ab8 100644 (file)
@@ -223,7 +223,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
        vexpress_config_set_master(vexpress_sysreg_get_master());
 
        /* Confirm board type against DT property, if available */
-       if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
+       if (of_property_read_u32(of_root, "arm,hbi", &dt_hbi) == 0) {
                u32 id = vexpress_get_procid(VEXPRESS_SITE_MASTER);
                u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK;
 
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge