of: Make device nodes kobjects so they show up in sysfs
[firefly-linux-kernel-4.4.55.git] / drivers / of / pdt.c
index 37b56fd716e6683e97cfcc4c381e7246d86d77ee..2d9d7e1c017fc9f182eed02cff7b6fbac29b4214 100644 (file)
@@ -180,8 +180,6 @@ static struct device_node * __init of_pdt_create_node(phandle node,
        of_pdt_incr_unique_id(dp);
        dp->parent = parent;
 
-       kref_init(&dp->kref);
-
        dp->name = of_pdt_get_one_property(node, "name");
        dp->type = of_pdt_get_one_property(node, "device_type");
        dp->phandle = node;
@@ -216,6 +214,7 @@ static struct device_node * __init of_pdt_build_tree(struct device_node *parent,
                *nextp = &dp->allnext;
 
                dp->full_name = of_pdt_build_full_name(dp);
+               of_node_add(dp);
 
                dp->child = of_pdt_build_tree(dp,
                                of_pdt_prom_ops->getchild(node), nextp);
@@ -246,6 +245,7 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
        of_allnodes->path_component_name = "";
 #endif
        of_allnodes->full_name = "/";
+       of_node_add(of_allnodes);
 
        nextp = &of_allnodes->allnext;
        of_allnodes->child = of_pdt_build_tree(of_allnodes,