aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/prom_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/prom_common.c')
-rw-r--r--arch/sparc/kernel/prom_common.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index 762056762b72..d3eddc76763d 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -184,7 +184,7 @@ static struct property * __init build_one_prop(phandle node, char *prev,
184 return p; 184 return p;
185} 185}
186 186
187struct property * __init build_prop_list(phandle node) 187static struct property * __init build_prop_list(phandle node)
188{ 188{
189 struct property *head, *tail; 189 struct property *head, *tail;
190 190
@@ -201,3 +201,42 @@ struct property * __init build_prop_list(phandle node)
201 201
202 return head; 202 return head;
203} 203}
204
205static char * __init get_one_property(phandle node, const char *name)
206{
207 char *buf = "<NULL>";
208 int len;
209
210 len = prom_getproplen(node, name);
211 if (len > 0) {
212 buf = prom_early_alloc(len);
213 len = prom_getproperty(node, name, buf, len);
214 }
215
216 return buf;
217}
218
219struct device_node * __init create_node(phandle node,
220 struct device_node *parent)
221{
222 struct device_node *dp;
223
224 if (!node)
225 return NULL;
226
227 dp = prom_early_alloc(sizeof(*dp));
228 dp->unique_id = prom_unique_id++;
229 dp->parent = parent;
230
231 kref_init(&dp->kref);
232
233 dp->name = get_one_property(node, "name");
234 dp->type = get_one_property(node, "device_type");
235 dp->node = node;
236
237 /* Build interrupts later... */
238
239 dp->properties = build_prop_list(node);
240
241 return dp;
242}