summaryrefslogtreecommitdiff
path: root/arch/ppc64/kernel/prom.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-11-09 01:07:12 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-09 01:07:12 -0500
commita892acacd3a8546ac161526522f13b5174f2c471 (patch)
treeee6d36f27f1388989ebfcabf90253fb7194112ac /arch/ppc64/kernel/prom.c
parent193515d51ccb363165d6b09e9ba5c21089e34bad (diff)
parent330d57fb98a916fa8e1363846540dd420e99499a (diff)
Merge branch 'master'
Diffstat (limited to 'arch/ppc64/kernel/prom.c')
-rw-r--r--arch/ppc64/kernel/prom.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index dece31e58bc4..3402fbee62c7 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -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>
@@ -46,7 +47,6 @@
#include <asm/pgtable.h>
#include <asm/pci.h>
#include <asm/iommu.h>
-#include <asm/ppcdebug.h>
#include <asm/btext.h>
#include <asm/sections.h>
#include <asm/machdep.h>
@@ -1866,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