summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Ölmann <u.oelmann@pengutronix.de>2018-12-18 14:57:37 +0100
committerRoland Hieber <rhi@pengutronix.de>2019-01-07 12:26:50 +0100
commit8e4b89211ac3e5b0b27c07c195715a35b7772ab3 (patch)
treec0d54e195d3edef534afe9b6fa4e97973ccdeddb
parent19f3bb5c06006b63adb8161116bd85f390a5f14c (diff)
downloaddt-utils-8e4b89211ac3e5b0b27c07c195715a35b7772ab3.tar.gz
dt-utils-8e4b89211ac3e5b0b27c07c195715a35b7772ab3.tar.xz
state: Create alias in of_state_fixup()
This ports the following barebox commit: | commit 70ea799f6b6ddcd92b94420a2d352a73f0f9ff08 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Thu May 4 12:50:59 2017 +0200 | | state: Create alias in of_state_fixup() | | When the kernel device tree is fixed up we assume that it doesn't | have a state node, so we must also assume that it doesn't have | a alias. Create it. | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
-rw-r--r--src/barebox-state/state.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/barebox-state/state.c b/src/barebox-state/state.c
index 9b658be..cbea317 100644
--- a/src/barebox-state/state.c
+++ b/src/barebox-state/state.c
@@ -407,7 +407,7 @@ static int of_state_fixup(struct device_node *root, void *ctx)
{
struct state *state = ctx;
const char *compatible = "barebox,state";
- struct device_node *new_node, *node, *parent, *backend_node;
+ struct device_node *new_node, *node, *parent, *backend_node, *aliases;
struct property *p;
int ret;
phandle phandle;
@@ -520,6 +520,17 @@ static int of_state_fixup(struct device_node *root, void *ctx)
if (ret)
goto out;
+ aliases = of_create_node(root, "/aliases");
+ if (!aliases) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ ret = of_set_property(aliases, state->name, new_node->full_name,
+ strlen(new_node->full_name) + 1, 1);
+ if (ret)
+ goto out;
+
/* delete existing node */
if (node)
of_delete_node(node);