diff options
author | David S. Miller <davem@davemloft.net> | 2008-12-05 04:00:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-05 20:04:22 -0500 |
commit | b9e5567cda6387e0f4061bfceebbc1bd63ee42a6 (patch) | |
tree | 0c7cc9f46f65b943fe8065ba2b3af31a3bbf06b1 /arch/sparc/kernel/prom_32.c | |
parent | e5ff0fe31d69e716f2599bcfb297ca3757e957c5 (diff) |
sparc: Move property building code into prom_common.c
Unfortunately there is some sparc32/sparc64 ifdef'ery in
here due to the difference in how the prom_firstprop()
and prom_nextprop() routines work.
This will be eliminated eventually.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/prom_32.c')
-rw-r--r-- | arch/sparc/kernel/prom_32.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index c34888a21b2d..a9859d2b2565 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c | |||
@@ -196,72 +196,6 @@ static char * __init build_full_name(struct device_node *dp) | |||
196 | return n; | 196 | return n; |
197 | } | 197 | } |
198 | 198 | ||
199 | static struct property * __init build_one_prop(phandle node, char *prev, char *special_name, void *special_val, int special_len) | ||
200 | { | ||
201 | static struct property *tmp = NULL; | ||
202 | struct property *p; | ||
203 | int len; | ||
204 | const char *name; | ||
205 | |||
206 | if (tmp) { | ||
207 | p = tmp; | ||
208 | memset(p, 0, sizeof(*p) + 32); | ||
209 | tmp = NULL; | ||
210 | } else { | ||
211 | p = prom_early_alloc(sizeof(struct property) + 32); | ||
212 | p->unique_id = prom_unique_id++; | ||
213 | } | ||
214 | |||
215 | p->name = (char *) (p + 1); | ||
216 | if (special_name) { | ||
217 | strcpy(p->name, special_name); | ||
218 | p->length = special_len; | ||
219 | p->value = prom_early_alloc(special_len); | ||
220 | memcpy(p->value, special_val, special_len); | ||
221 | } else { | ||
222 | if (prev == NULL) { | ||
223 | name = prom_firstprop(node, NULL); | ||
224 | } else { | ||
225 | name = prom_nextprop(node, prev, NULL); | ||
226 | } | ||
227 | if (strlen(name) == 0) { | ||
228 | tmp = p; | ||
229 | return NULL; | ||
230 | } | ||
231 | strcpy(p->name, name); | ||
232 | p->length = prom_getproplen(node, p->name); | ||
233 | if (p->length <= 0) { | ||
234 | p->length = 0; | ||
235 | } else { | ||
236 | p->value = prom_early_alloc(p->length + 1); | ||
237 | len = prom_getproperty(node, p->name, p->value, | ||
238 | p->length); | ||
239 | if (len <= 0) | ||
240 | p->length = 0; | ||
241 | ((unsigned char *)p->value)[p->length] = '\0'; | ||
242 | } | ||
243 | } | ||
244 | return p; | ||
245 | } | ||
246 | |||
247 | static struct property * __init build_prop_list(phandle node) | ||
248 | { | ||
249 | struct property *head, *tail; | ||
250 | |||
251 | head = tail = build_one_prop(node, NULL, | ||
252 | ".node", &node, sizeof(node)); | ||
253 | |||
254 | tail->next = build_one_prop(node, NULL, NULL, NULL, 0); | ||
255 | tail = tail->next; | ||
256 | while(tail) { | ||
257 | tail->next = build_one_prop(node, tail->name, | ||
258 | NULL, NULL, 0); | ||
259 | tail = tail->next; | ||
260 | } | ||
261 | |||
262 | return head; | ||
263 | } | ||
264 | |||
265 | static char * __init get_one_property(phandle node, char *name) | 199 | static char * __init get_one_property(phandle node, char *name) |
266 | { | 200 | { |
267 | char *buf = "<NULL>"; | 201 | char *buf = "<NULL>"; |