summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Ölmann <u.oelmann@pengutronix.de>2018-12-18 14:57:27 +0100
committerRoland Hieber <rhi@pengutronix.de>2019-01-07 12:26:49 +0100
commitcb06d48dccd36401d94f8735065fbbe1b5706143 (patch)
treec4c5909df8511f852440902d93947cbbd054906e
parenta154e96beaf9eab52e58dd1df44195704bc2b27c (diff)
downloaddt-utils-cb06d48dccd36401d94f8735065fbbe1b5706143.tar.gz
dt-utils-cb06d48dccd36401d94f8735065fbbe1b5706143.tar.xz
state: Make pointing to the backend using a phandle the only supported method
This ports the following barebox commit and removes the now no longer used noop definition of of_find_path(): | commit 99020ca016f5569a14ef7571384a0205f13522e8 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Tue Mar 21 13:57:51 2017 +0100 | | 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> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
-rw-r--r--src/barebox-state/state.c21
-rw-r--r--src/dt/dt.h6
2 files changed, 9 insertions, 18 deletions
diff --git a/src/barebox-state/state.c b/src/barebox-state/state.c
index 4adc065..bfd7c56 100644
--- a/src/barebox-state/state.c
+++ b/src/barebox-state/state.c
@@ -572,19 +572,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",
diff --git a/src/dt/dt.h b/src/dt/dt.h
index 67f5fb7..8014cd3 100644
--- a/src/dt/dt.h
+++ b/src/dt/dt.h
@@ -370,12 +370,6 @@ static inline struct device_node *of_find_root_node(struct device_node *node)
struct device_node *of_read_proc_devicetree(void);
-static inline int of_find_path(struct device_node *node, const char *propname,
- char **outpath, unsigned flags)
-{
- return -ENOSYS;
-}
-
static inline int of_find_path_by_node(struct device_node *node, char **outpath,
unsigned flags)
{