[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:
@@ -870,9 +870,7 @@ static int __init get_freq(char *name, int cells, unsigned long *val)
|
||||
fp = get_property(cpu, name, NULL);
|
||||
if (fp) {
|
||||
found = 1;
|
||||
*val = 0;
|
||||
while (cells--)
|
||||
*val = (*val << 32) | *fp++;
|
||||
*val = of_read_ulong(fp, cells);
|
||||
}
|
||||
|
||||
of_node_put(cpu);
|
||||
|
Reference in New Issue
Block a user