diff options
author | Paul Mackerras <paulus@samba.org> | 2006-09-19 00:06:27 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-09-20 01:09:48 -0400 |
commit | a4dc7ff08915a2035aa6d6decc53fa1deaa410bb (patch) | |
tree | 9b28af3a21f915e3fe8ed7ee163be1b1d2bfe8b0 /arch/powerpc/kernel/setup-common.c | |
parent | 19e59df4dc2e6f7b46190ee77ce7093769f597a7 (diff) |
[POWERPC] Define of_read_ulong helper
There are various places where we want to extract an unsigned long
value from a device-tree property that can be 1 or 2 cells in length.
This replaces some open-coded calculations, and one place where we
assumed without checking that properties were the length we wanted,
with a little of_read_ulong() helper.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/setup-common.c')
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 465e7435efbc..0af3fc1bdcc9 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -304,18 +304,21 @@ struct seq_operations cpuinfo_op = { | |||
304 | void __init check_for_initrd(void) | 304 | void __init check_for_initrd(void) |
305 | { | 305 | { |
306 | #ifdef CONFIG_BLK_DEV_INITRD | 306 | #ifdef CONFIG_BLK_DEV_INITRD |
307 | const unsigned long *prop; | 307 | const unsigned int *prop; |
308 | int len; | ||
308 | 309 | ||
309 | DBG(" -> check_for_initrd()\n"); | 310 | DBG(" -> check_for_initrd()\n"); |
310 | 311 | ||
311 | if (of_chosen) { | 312 | if (of_chosen) { |
312 | prop = get_property(of_chosen, "linux,initrd-start", NULL); | 313 | prop = get_property(of_chosen, "linux,initrd-start", &len); |
313 | if (prop != NULL) { | 314 | if (prop != NULL) { |
314 | initrd_start = (unsigned long)__va(*prop); | 315 | initrd_start = (unsigned long) |
316 | __va(of_read_ulong(prop, len / 4)); | ||
315 | prop = get_property(of_chosen, | 317 | prop = get_property(of_chosen, |
316 | "linux,initrd-end", NULL); | 318 | "linux,initrd-end", &len); |
317 | if (prop != NULL) { | 319 | if (prop != NULL) { |
318 | initrd_end = (unsigned long)__va(*prop); | 320 | initrd_end = (unsigned long) |
321 | __va(of_read_ulong(prop, len / 4)); | ||
319 | initrd_below_start_ok = 1; | 322 | initrd_below_start_ok = 1; |
320 | } else | 323 | } else |
321 | initrd_start = 0; | 324 | initrd_start = 0; |