[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>
This commit is contained in:
Paul Mackerras
2006-09-19 14:06:27 +10:00
parent 19e59df4dc
commit a4dc7ff089
4 changed files with 22 additions and 26 deletions

View File

@@ -304,18 +304,21 @@ struct seq_operations cpuinfo_op = {
void __init check_for_initrd(void)
{
#ifdef CONFIG_BLK_DEV_INITRD
const unsigned long *prop;
const unsigned int *prop;
int len;
DBG(" -> check_for_initrd()\n");
if (of_chosen) {
prop = get_property(of_chosen, "linux,initrd-start", NULL);
prop = get_property(of_chosen, "linux,initrd-start", &len);
if (prop != NULL) {
initrd_start = (unsigned long)__va(*prop);
initrd_start = (unsigned long)
__va(of_read_ulong(prop, len / 4));
prop = get_property(of_chosen,
"linux,initrd-end", NULL);
"linux,initrd-end", &len);
if (prop != NULL) {
initrd_end = (unsigned long)__va(*prop);
initrd_end = (unsigned long)
__va(of_read_ulong(prop, len / 4));
initrd_below_start_ok = 1;
} else
initrd_start = 0;