usb: dwc_otg_310: fix usb vbus power controlled by pmic
[firefly-linux-kernel-4.4.55.git] / drivers / of / dynamic.c
index 16524c8e95ec34cf03879eff0b5133ca9373bd0d..2d72ddcf534f02699c1ea3b2ed2471670e5a85e9 100644 (file)
@@ -45,6 +45,9 @@ void __of_detach_node_sysfs(struct device_node *np)
 {
        struct property *pp;
 
+       if (!IS_ENABLED(CONFIG_SYSFS))
+               return;
+
        BUG_ON(!of_node_is_initialized(np));
        if (!of_kset)
                return;
@@ -52,7 +55,7 @@ void __of_detach_node_sysfs(struct device_node *np)
        /* only remove properties if on sysfs */
        if (of_node_is_attached(np)) {
                for_each_property_of_node(np, pp)
-                       sysfs_remove_bin_file(&np->kobj, &pp->attr);
+                       __of_sysfs_remove_bin_file(np, pp);
                kobject_del(&np->kobj);
        }
 
@@ -222,14 +225,12 @@ void __of_attach_node(struct device_node *np)
        phandle = __of_get_property(np, "phandle", &sz);
        if (!phandle)
                phandle = __of_get_property(np, "linux,phandle", &sz);
-       if (IS_ENABLED(PPC_PSERIES) && !phandle)
+       if (IS_ENABLED(CONFIG_PPC_PSERIES) && !phandle)
                phandle = __of_get_property(np, "ibm,phandle", &sz);
        np->phandle = (phandle && (sz >= 4)) ? be32_to_cpup(phandle) : 0;
 
        np->child = NULL;
        np->sibling = np->parent->child;
-       np->allnext = np->parent->allnext;
-       np->parent->allnext = np;
        np->parent->child = np;
        of_node_clear_flag(np, OF_DETACHED);
 }
@@ -269,17 +270,6 @@ void __of_detach_node(struct device_node *np)
        if (WARN_ON(!parent))
                return;
 
-       if (of_allnodes == np)
-               of_allnodes = np->allnext;
-       else {
-               struct device_node *prev;
-               for (prev = of_allnodes;
-                    prev->allnext != np;
-                    prev = prev->allnext)
-                       ;
-               prev->allnext = np->allnext;
-       }
-
        if (parent->child == np)
                parent->child = np->sibling;
        else {
@@ -366,7 +356,7 @@ void of_node_release(struct kobject *kobj)
  * @allocflags:        Allocation flags (typically pass GFP_KERNEL)
  *
  * Copy a property by dynamically allocating the memory of both the
- * property stucture and the property name & contents. The property's
+ * property structure and the property name & contents. The property's
  * flags have the OF_DYNAMIC bit set so that we can differentiate between
  * dynamically allocated properties and not.
  * Returns the newly allocated property or NULL on out of memory error.
@@ -381,7 +371,7 @@ struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
 
        /*
         * NOTE: There is no check for zero length value.
-        * In case of a boolean property This will allocate a value
+        * In case of a boolean property, this will allocate a value
         * of zero bytes. We do this to work around the use
         * of of_get_property() calls on boolean values.
         */