Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91617
b: refs/heads/master
c: f4ac7b5
h: refs/heads/master
i:
  91615: f6c89eb
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed Apr 18, 2008
1 parent 5bd55f3 commit d33b5d0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f13f4ca8036516ca1b99a41f95f7dea7e4dce104
refs/heads/master: f4ac7b5eb79ef15819c966b1f6b84bf443949123
28 changes: 17 additions & 11 deletions trunk/arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,12 +1332,14 @@ EXPORT_SYMBOL(of_node_put);
*/
void of_attach_node(struct device_node *np)
{
write_lock(&devtree_lock);
unsigned long flags;

write_lock_irqsave(&devtree_lock, flags);
np->sibling = np->parent->child;
np->allnext = allnodes;
np->parent->child = np;
allnodes = np;
write_unlock(&devtree_lock);
write_unlock_irqrestore(&devtree_lock, flags);
}

/*
Expand All @@ -1348,8 +1350,9 @@ void of_attach_node(struct device_node *np)
void of_detach_node(struct device_node *np)
{
struct device_node *parent;
unsigned long flags;

write_lock(&devtree_lock);
write_lock_irqsave(&devtree_lock, flags);

parent = np->parent;
if (!parent)
Expand Down Expand Up @@ -1380,7 +1383,7 @@ void of_detach_node(struct device_node *np)
of_node_set_flag(np, OF_DETACHED);

out_unlock:
write_unlock(&devtree_lock);
write_unlock_irqrestore(&devtree_lock, flags);
}

#ifdef CONFIG_PPC_PSERIES
Expand Down Expand Up @@ -1461,20 +1464,21 @@ __initcall(prom_reconfig_setup);
int prom_add_property(struct device_node* np, struct property* prop)
{
struct property **next;
unsigned long flags;

prop->next = NULL;
write_lock(&devtree_lock);
write_lock_irqsave(&devtree_lock, flags);
next = &np->properties;
while (*next) {
if (strcmp(prop->name, (*next)->name) == 0) {
/* duplicate ! don't insert it */
write_unlock(&devtree_lock);
write_unlock_irqrestore(&devtree_lock, flags);
return -1;
}
next = &(*next)->next;
}
*next = prop;
write_unlock(&devtree_lock);
write_unlock_irqrestore(&devtree_lock, flags);

#ifdef CONFIG_PROC_DEVICETREE
/* try to add to proc as well if it was initialized */
Expand All @@ -1494,9 +1498,10 @@ int prom_add_property(struct device_node* np, struct property* prop)
int prom_remove_property(struct device_node *np, struct property *prop)
{
struct property **next;
unsigned long flags;
int found = 0;

write_lock(&devtree_lock);
write_lock_irqsave(&devtree_lock, flags);
next = &np->properties;
while (*next) {
if (*next == prop) {
Expand All @@ -1509,7 +1514,7 @@ int prom_remove_property(struct device_node *np, struct property *prop)
}
next = &(*next)->next;
}
write_unlock(&devtree_lock);
write_unlock_irqrestore(&devtree_lock, flags);

if (!found)
return -ENODEV;
Expand All @@ -1535,9 +1540,10 @@ int prom_update_property(struct device_node *np,
struct property *oldprop)
{
struct property **next;
unsigned long flags;
int found = 0;

write_lock(&devtree_lock);
write_lock_irqsave(&devtree_lock, flags);
next = &np->properties;
while (*next) {
if (*next == oldprop) {
Expand All @@ -1551,7 +1557,7 @@ int prom_update_property(struct device_node *np,
}
next = &(*next)->next;
}
write_unlock(&devtree_lock);
write_unlock_irqrestore(&devtree_lock, flags);

if (!found)
return -ENODEV;
Expand Down

0 comments on commit d33b5d0

Please sign in to comment.