aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/prom.c
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2007-04-24 02:46:53 -0400
committerStephen Rothwell <sfr@canb.auug.org.au>2007-07-19 23:32:24 -0400
commit581b605a83ec241a2aff8ef780e08b9414c8dfd8 (patch)
tree809640a0dc3a1bd0b5afba795cf9f6357f6e3a81 /arch/powerpc/kernel/prom.c
parent0081cbc3731de8ad4744ba433af51f17bf27eb9c (diff)
Consolidate of_find_property
The only change here is that a readlock is taken while the property list is being traversed on Sparc where it was not taken previously. Also, Sparc uses strcasecmp to compare property names while PowerPC uses strcmp. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Acked-by: Paul Mackerras <paulus@samba.org> Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r--arch/powerpc/kernel/prom.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index c009d2155f9c..3f6238d96a5d 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -80,10 +80,7 @@ struct boot_param_header *initial_boot_params;
80 80
81static struct device_node *allnodes = NULL; 81static struct device_node *allnodes = NULL;
82 82
83/* use when traversing tree through the allnext, child, sibling, 83extern rwlock_t devtree_lock; /* temporary while merging */
84 * or parent members of struct device_node.
85 */
86static DEFINE_RWLOCK(devtree_lock);
87 84
88/* export that to outside world */ 85/* export that to outside world */
89struct device_node *of_chosen; 86struct device_node *of_chosen;
@@ -1489,25 +1486,6 @@ static int __init prom_reconfig_setup(void)
1489__initcall(prom_reconfig_setup); 1486__initcall(prom_reconfig_setup);
1490#endif 1487#endif
1491 1488
1492struct property *of_find_property(const struct device_node *np,
1493 const char *name,
1494 int *lenp)
1495{
1496 struct property *pp;
1497
1498 read_lock(&devtree_lock);
1499 for (pp = np->properties; pp != 0; pp = pp->next)
1500 if (strcmp(pp->name, name) == 0) {
1501 if (lenp != 0)
1502 *lenp = pp->length;
1503 break;
1504 }
1505 read_unlock(&devtree_lock);
1506
1507 return pp;
1508}
1509EXPORT_SYMBOL(of_find_property);
1510
1511/* 1489/*
1512 * Add a property to a node 1490 * Add a property to a node
1513 */ 1491 */