mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-21 22:23:05 +00:00
adt: Use the current node's #address-cells to translate "ranges"
Fixes adt_get_reg() for the nvram partition. Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
parent
650441daa5
commit
0cf2302f35
1 changed files with 4 additions and 4 deletions
|
@ -317,13 +317,12 @@ int adt_get_reg(const void *adt, int *path, const char *prop, int idx, u64 *padd
|
|||
if (!ranges)
|
||||
break;
|
||||
|
||||
u32 pa_cells = 2, ps_cells = 1;
|
||||
u32 pa_cells = 2;
|
||||
ADT_GETPROP(adt, parent, "#address-cells", &pa_cells);
|
||||
ADT_GETPROP(adt, parent, "#size-cells", &ps_cells);
|
||||
|
||||
dprintf(" translate range to address-cells=%d size-cells=%d\n", pa_cells, ps_cells);
|
||||
|
||||
if (pa_cells < 1 || pa_cells > 2 || ps_cells > 2)
|
||||
if (pa_cells < 1 || pa_cells > 2 || s_cells > 2)
|
||||
return ADT_ERR_BADNCELLS;
|
||||
|
||||
int range_cnt = ranges_len / (4 * (pa_cells + a_cells + s_cells));
|
||||
|
@ -344,8 +343,9 @@ int adt_get_reg(const void *adt, int *path, const char *prop, int idx, u64 *padd
|
|||
}
|
||||
}
|
||||
|
||||
ADT_GETPROP(adt, parent, "#size-cells", &s_cells);
|
||||
|
||||
a_cells = pa_cells;
|
||||
s_cells = ps_cells;
|
||||
}
|
||||
|
||||
if (paddr)
|
||||
|
|
Loading…
Reference in a new issue