diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-21 13:57:51 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-31 18:43:53 +0200 |
commit | 99020ca016f5569a14ef7571384a0205f13522e8 (patch) | |
tree | 35181d160941f21dad895366b550cf9c598a5bd7 /common/state | |
parent | 12960a57841d5e6ea04fd523611e15a9a4170c89 (diff) | |
download | barebox-99020ca016f5569a14ef7571384a0205f13522e8.tar.gz barebox-99020ca016f5569a14ef7571384a0205f13522e8.tar.xz |
state: Make pointing to the backend using a phandle the only supported method
All other methods are broken for some time already: When starting the
kernel the state code rewrites the state node in the device tree and
replaced the "backend" property with a phandle - even when the target
can't be described as a phandle. Since using phandles is the nicest way
to point to the storage device anyway remove the other methods.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/state')
-rw-r--r-- | common/state/state.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/common/state/state.c b/common/state/state.c index 02bb1bb24a..6e6b3a6f08 100644 --- a/common/state/state.c +++ b/common/state/state.c @@ -452,19 +452,16 @@ struct state *state_new_from_node(struct device_node *node, char *path, } if (!path) { - /* guess if of_path is a path, not a phandle */ - if (of_path[0] == '/' && len > 1) { - ret = of_find_path(node, "backend", &path, 0); - } else { - struct device_node *partition_node; - - partition_node = of_parse_phandle(node, "backend", 0); - if (!partition_node) - goto out_release_state; - - of_path = partition_node->full_name; - ret = of_find_path_by_node(partition_node, &path, 0); + struct device_node *partition_node; + + partition_node = of_parse_phandle(node, "backend", 0); + if (!partition_node) { + dev_err(&state->dev, "Cannot resolve \"backend\" phandle\n"); + goto out_release_state; } + + of_path = partition_node->full_name; + ret = of_find_path_by_node(partition_node, &path, 0); if (ret) { if (ret != -EPROBE_DEFER) dev_err(&state->dev, "state failed to parse path to backend: %s\n", |