diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-05-04 12:50:59 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-05-04 12:57:06 +0200 |
commit | 70ea799f6b6ddcd92b94420a2d352a73f0f9ff08 (patch) | |
tree | 585d6064f71700d0f27c460fd852681b1bfb8a00 | |
parent | 49831918036ab3292870dc2c6035292e6af47ae1 (diff) | |
download | barebox-70ea799f6b6ddcd92b94420a2d352a73f0f9ff08.tar.gz barebox-70ea799f6b6ddcd92b94420a2d352a73f0f9ff08.tar.xz |
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>
-rw-r--r-- | common/state/state.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/common/state/state.c b/common/state/state.c index 41bee0fdc5..b4a634fa99 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); |