mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-14 03:17:05 +00:00
kboot: Make dt_get_or_add_reserved_mem mutate existing nodes
This means we can use it with pre-created nodes in the DT. Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
4ae23577cc
commit
5a632bad87
1 changed files with 12 additions and 13 deletions
|
@ -1264,9 +1264,7 @@ static int dt_get_or_add_reserved_mem(const char *node_name, const char *compat,
|
||||||
bail("FDT: '/reserved-memory' not found\n");
|
bail("FDT: '/reserved-memory' not found\n");
|
||||||
|
|
||||||
int node = fdt_subnode_offset(dt, resv_node, node_name);
|
int node = fdt_subnode_offset(dt, resv_node, node_name);
|
||||||
if (node >= 0)
|
if (node < 0) {
|
||||||
return node;
|
|
||||||
|
|
||||||
node = fdt_add_subnode(dt, resv_node, node_name);
|
node = fdt_add_subnode(dt, resv_node, node_name);
|
||||||
if (node < 0)
|
if (node < 0)
|
||||||
bail("FDT: failed to add node '%s' to '/reserved-memory'\n", node_name);
|
bail("FDT: failed to add node '%s' to '/reserved-memory'\n", node_name);
|
||||||
|
@ -1279,6 +1277,7 @@ static int dt_get_or_add_reserved_mem(const char *node_name, const char *compat,
|
||||||
ret = fdt_setprop_u32(dt, node, "phandle", phandle);
|
ret = fdt_setprop_u32(dt, node, "phandle", phandle);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
bail("FDT: couldn't set '%s.phandle' property: %d\n", node_name, ret);
|
bail("FDT: couldn't set '%s.phandle' property: %d\n", node_name, ret);
|
||||||
|
}
|
||||||
|
|
||||||
u64 reg[2] = {cpu_to_fdt64(paddr), cpu_to_fdt64(size)};
|
u64 reg[2] = {cpu_to_fdt64(paddr), cpu_to_fdt64(size)};
|
||||||
ret = fdt_setprop(dt, node, "reg", reg, sizeof(reg));
|
ret = fdt_setprop(dt, node, "reg", reg, sizeof(reg));
|
||||||
|
|
Loading…
Reference in a new issue