state: suppress state overwrite warning for barebox DT
PATCH 1/1 state: suppress state overwrite warning for barebox DT
Nowadays, the root != of_get_root_node() check always evaluates to true, because fixups are never applied onto the barebox live tree directly, but at a copy. This was necessary to allow repeated fixups, e.g. by of_diff - + or with multiple boot targets.
The check was useful to have though to differentiate between the case that the barebox DT is passed to Linux (where it's benign that the state node is overwritten) or the Linux DT having a state node (which can mislead as the kernel will be overwritten).
barebox already handles $properties specially in that it refuses to create them when unflattening and silently drops them when flattening.
This allows associating data with a node for the duration it's unflattened in barebox memory.
Make use of this by marking the barebox live tree's root node as such, so even it's duplicates don't trigger the warning while external DTs would.
--- common/state/state.c | 2 +- drivers/of/base.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
common/state/state.c +1 -1
@@ -453,7 +453,7 @@ static int of_state_fixup(struct device_node *root, void *ctx)* will be overwritten. Warn about this so people do not wonder why * changes in the kernels state node do not have any effect. */ -if (root !=of_get_root_node ()) +if (!of_property_read_bool (root,"$barebox,root-node" ))dev_warn (&state->dev,"Warning: Kernel devicetree contains state node, replacing it\n" ); }else {char *of_path, *c;
drivers/of/base.c +1 -0
@@ -2084,6 +2084,7 @@ int of_set_root_node(struct device_node *node) of_chosen =of_find_node_by_path ("/chosen" );of_property_read_string (root_node,"model" , &of_model); +of_property_write_bool (root_node,"$barebox,root-node" , true);if (of_model)barebox_set_model (of_model);
Signature · 1 line
2.47.3
Sascha Hauer
AppliedQuoted 11 lines · Ahmad Fatoum
Nowadays, the root !=
of_get_root_node()check always evaluates to true, because fixups are never applied onto the barebox live tree directly, but at a copy. This was necessary to allow repeated fixups, e.g. byof_diff- + or with multiple boot targets.The check was useful to have though to differentiate between the case that the barebox DT is passed to Linux (where it's benign that the state node is overwritten) or the Linux DT having a state node (which can mislead as the kernel will be overwritten).
[...]
Applied, thanks!
[1/1] state: suppress state overwrite warning for barebox DT
https://git.pengutronix.de/cgit/barebox/commit/?id=40e7f324b675 (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>