[PATCH] ppc64: SMU partition recovery
[deliverable/linux.git] / arch / ppc64 / kernel / prom.c
index 0e8961dea3bca0ef72302657462f25285c15f1db..3402fbee62c74af1faf5ccd7013afc4199c4ce2b 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/initrd.h>
 #include <linux/bitops.h>
 #include <linux/module.h>
+#include <linux/module.h>
 
 #include <asm/prom.h>
 #include <asm/rtas.h>
@@ -1865,17 +1866,32 @@ get_property(struct device_node *np, const char *name, int *lenp)
 EXPORT_SYMBOL(get_property);
 
 /*
- * Add a property to a node
+ * Add a property to a node.
  */
-void
+int
 prom_add_property(struct device_node* np, struct property* prop)
 {
-       struct property **next = &np->properties;
+       struct property **next;
 
        prop->next = NULL;      
-       while (*next)
+       write_lock(&devtree_lock);
+       next = &np->properties;
+       while (*next) {
+               if (strcmp(prop->name, (*next)->name) == 0) {
+                       /* duplicate ! don't insert it */
+                       write_unlock(&devtree_lock);
+                       return -1;
+               }
                next = &(*next)->next;
+       }
        *next = prop;
+       write_unlock(&devtree_lock);
+
+       /* try to add to proc as well if it was initialized */
+       if (np->pde)
+               proc_device_tree_add_prop(np->pde, prop);
+
+       return 0;
 }
 
 #if 0
This page took 0.027145 seconds and 5 git commands to generate.