write_lock_irqsave(&devtree_lock, flags);
        np->sibling = np->parent->child;
 -      np->allnext = allnodes;
 +      np->allnext = of_allnodes;
        np->parent->child = np;
 -      allnodes = np;
 +      of_allnodes = np;
        write_unlock_irqrestore(&devtree_lock, flags);
+ 
+       of_add_proc_dt_entry(np);
+       return 0;
  }
  
+ #ifdef CONFIG_PROC_DEVICETREE
+ static void of_remove_proc_dt_entry(struct device_node *dn)
+ {
+       struct device_node *parent = dn->parent;
+       struct property *prop = dn->properties;
+ 
+       while (prop) {
+               remove_proc_entry(prop->name, dn->pde);
+               prop = prop->next;
+       }
+ 
+       if (dn->pde)
+               remove_proc_entry(dn->pde->name, parent->pde);
+ }
+ #else
+ static void of_remove_proc_dt_entry(struct device_node *dn)
+ {
+       return;
+ }
+ #endif
+ 
  /**
   * of_detach_node - "Unplug" a node from the device tree.
   *
  
        write_lock_irqsave(&devtree_lock, flags);
  
+       if (of_node_check_flag(np, OF_DETACHED)) {
+               /* someone already detached it */
+               write_unlock_irqrestore(&devtree_lock, flags);
+               return rc;
+       }
+ 
        parent = np->parent;
-       if (!parent)
-               goto out_unlock;
+       if (!parent) {
+               write_unlock_irqrestore(&devtree_lock, flags);
+               return rc;
+       }
  
 -      if (allnodes == np)
 -              allnodes = np->allnext;
 +      if (of_allnodes == np)
 +              of_allnodes = np->allnext;
        else {
                struct device_node *prev;
 -              for (prev = allnodes;
 +              for (prev = of_allnodes;
                     prev->allnext != np;
                     prev = prev->allnext)
                        ;
 
  
          If unsure, say N.
  
- config PSERIES_RECONFIG_NOTIFIER_ERROR_INJECT
-       tristate "pSeries reconfig notifier error injection module"
-       depends on PPC_PSERIES && NOTIFIER_ERROR_INJECTION
+ config OF_RECONFIG_NOTIFIER_ERROR_INJECT
+       tristate "OF reconfig notifier error injection module"
+       depends on OF_DYNAMIC && NOTIFIER_ERROR_INJECTION
        help
 -        This option provides the ability to inject artifical errors to
 +        This option provides the ability to inject artificial errors to
-         pSeries reconfig notifier chain callbacks.  It is controlled
+         OF reconfig notifier chain callbacks.  It is controlled
          through debugfs interface under
-         /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/
+         /sys/kernel/debug/notifier-error-inject/OF-reconfig/
  
          If the notifier call chain should be failed with some events
          notified, write the error code to "actions/<notifier event>/error".