aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/prom.c24
-rw-r--r--arch/sparc/kernel/prom.c22
-rw-r--r--arch/sparc64/kernel/prom.c22
-rw-r--r--drivers/of/base.c26
-rw-r--r--include/asm-powerpc/prom.h1
-rw-r--r--include/asm-sparc/prom.h1
-rw-r--r--include/asm-sparc64/prom.h1
7 files changed, 32 insertions, 65 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 */
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index f2ce0d48e102..0f5aab4326b3 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -27,10 +27,7 @@
27 27
28static struct device_node *allnodes; 28static struct device_node *allnodes;
29 29
30/* use when traversing tree through the allnext, child, sibling, 30extern rwlock_t devtree_lock; /* temporary while merging */
31 * or parent members of struct device_node.
32 */
33static DEFINE_RWLOCK(devtree_lock);
34 31
35struct device_node *of_get_parent(const struct device_node *node) 32struct device_node *of_get_parent(const struct device_node *node)
36{ 33{
@@ -130,23 +127,6 @@ struct device_node *of_find_compatible_node(struct device_node *from,
130} 127}
131EXPORT_SYMBOL(of_find_compatible_node); 128EXPORT_SYMBOL(of_find_compatible_node);
132 129
133struct property *of_find_property(const struct device_node *np,
134 const char *name,
135 int *lenp)
136{
137 struct property *pp;
138
139 for (pp = np->properties; pp != 0; pp = pp->next) {
140 if (strcasecmp(pp->name, name) == 0) {
141 if (lenp != 0)
142 *lenp = pp->length;
143 break;
144 }
145 }
146 return pp;
147}
148EXPORT_SYMBOL(of_find_property);
149
150int of_getintprop_default(struct device_node *np, const char *name, int def) 130int of_getintprop_default(struct device_node *np, const char *name, int def)
151{ 131{
152 struct property *prop; 132 struct property *prop;
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 4d6fb07f047f..a1ccc00c7958 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -32,10 +32,7 @@
32 32
33static struct device_node *allnodes; 33static struct device_node *allnodes;
34 34
35/* use when traversing tree through the allnext, child, sibling, 35extern rwlock_t devtree_lock; /* temporary while merging */
36 * or parent members of struct device_node.
37 */
38static DEFINE_RWLOCK(devtree_lock);
39 36
40struct device_node *of_get_parent(const struct device_node *node) 37struct device_node *of_get_parent(const struct device_node *node)
41{ 38{
@@ -135,23 +132,6 @@ struct device_node *of_find_compatible_node(struct device_node *from,
135} 132}
136EXPORT_SYMBOL(of_find_compatible_node); 133EXPORT_SYMBOL(of_find_compatible_node);
137 134
138struct property *of_find_property(const struct device_node *np,
139 const char *name,
140 int *lenp)
141{
142 struct property *pp;
143
144 for (pp = np->properties; pp != 0; pp = pp->next) {
145 if (strcasecmp(pp->name, name) == 0) {
146 if (lenp != 0)
147 *lenp = pp->length;
148 break;
149 }
150 }
151 return pp;
152}
153EXPORT_SYMBOL(of_find_property);
154
155int of_getintprop_default(struct device_node *np, const char *name, int def) 135int of_getintprop_default(struct device_node *np, const char *name, int def)
156{ 136{
157 struct property *prop; 137 struct property *prop;
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d6dc5e74c27c..70b60845140e 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -18,6 +18,12 @@
18 */ 18 */
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/spinlock.h>
22
23/* use when traversing tree through the allnext, child, sibling,
24 * or parent members of struct device_node.
25 */
26DEFINE_RWLOCK(devtree_lock);
21 27
22int of_n_addr_cells(struct device_node *np) 28int of_n_addr_cells(struct device_node *np)
23{ 29{
@@ -51,6 +57,26 @@ int of_n_size_cells(struct device_node *np)
51} 57}
52EXPORT_SYMBOL(of_n_size_cells); 58EXPORT_SYMBOL(of_n_size_cells);
53 59
60struct property *of_find_property(const struct device_node *np,
61 const char *name,
62 int *lenp)
63{
64 struct property *pp;
65
66 read_lock(&devtree_lock);
67 for (pp = np->properties; pp != 0; pp = pp->next) {
68 if (of_prop_cmp(pp->name, name) == 0) {
69 if (lenp != 0)
70 *lenp = pp->length;
71 break;
72 }
73 }
74 read_unlock(&devtree_lock);
75
76 return pp;
77}
78EXPORT_SYMBOL(of_find_property);
79
54/* 80/*
55 * Find a property with a given name for a given node 81 * Find a property with a given name for a given node
56 * and return the value. 82 * and return the value.
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index b05f8f26940a..75b1144ca580 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -25,6 +25,7 @@
25#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 25#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
26 26
27#define of_compat_cmp(s1, s2, l) strncasecmp((s1), (s2), (l)) 27#define of_compat_cmp(s1, s2, l) strncasecmp((s1), (s2), (l))
28#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
28 29
29/* Definitions used by the flattened device tree */ 30/* Definitions used by the flattened device tree */
30#define OF_DT_HEADER 0xd00dfeed /* marker */ 31#define OF_DT_HEADER 0xd00dfeed /* marker */
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index c755c69404f7..57f86c84293b 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -24,6 +24,7 @@
24#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 24#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
25 25
26#define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l)) 26#define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l))
27#define of_prop_cmp(s1, s2) strcasecmp((s1), (s2))
27 28
28typedef u32 phandle; 29typedef u32 phandle;
29typedef u32 ihandle; 30typedef u32 ihandle;
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index 040d198ee842..6a5e2405cbf4 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -24,6 +24,7 @@
24#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 24#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
25 25
26#define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l)) 26#define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l))
27#define of_prop_cmp(s1, s2) strcasecmp((s1), (s2))
27 28
28typedef u32 phandle; 29typedef u32 phandle;
29typedef u32 ihandle; 30typedef u32 ihandle;