summaryrefslogtreecommitdiffstats
path: root/common/state
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-05-04 12:50:59 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-05-04 12:57:06 +0200
commit70ea799f6b6ddcd92b94420a2d352a73f0f9ff08 (patch)
tree585d6064f71700d0f27c460fd852681b1bfb8a00 /common/state
parent49831918036ab3292870dc2c6035292e6af47ae1 (diff)
downloadbarebox-70ea799f6b6ddcd92b94420a2d352a73f0f9ff08.tar.gz
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>
Diffstat (limited to 'common/state')
-rw-r--r--common/state/state.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/common/state/state.c b/common/state/state.c
index 41bee0f..b4a634f 100644
--- a/common/state/state.c
+++ b/common/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);