summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Ölmann <u.oelmann@pengutronix.de>2018-12-18 14:57:28 +0100
committerRoland Hieber <rhi@pengutronix.de>2019-01-07 12:26:49 +0100
commit97ab800e45459e9027d3000d1994c7e536b6abe7 (patch)
treeb97b8e3560e44a664b470e49c0438eee61aae075
parentcb06d48dccd36401d94f8735065fbbe1b5706143 (diff)
downloaddt-utils-97ab800e45459e9027d3000d1994c7e536b6abe7.tar.gz
dt-utils-97ab800e45459e9027d3000d1994c7e536b6abe7.tar.xz
state: find device node from device path, not from device node path
This adds a dummy version of of_find_node_by_devpath() to make the linker happy and ports the following barebox commit: | commit e627903d59b7f7d085e53a0dc9ed942bcc63dff9 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Thu Mar 30 16:33:26 2017 +0200 | | state: find device node from device path, not from device node path | | The device node path may change from the internal device tree to the | one Linux is started with, so using this path to fixup the tree is | not very robust. Instead, use of_find_node_by_devpath() which has | been created for exactly this purpose. | | 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.c10
-rw-r--r--src/barebox-state/state.h2
-rw-r--r--src/dt/dt.h6
3 files changed, 12 insertions, 6 deletions
diff --git a/src/barebox-state/state.c b/src/barebox-state/state.c
index bfd7c56..a0a3901 100644
--- a/src/barebox-state/state.c
+++ b/src/barebox-state/state.c
@@ -460,7 +460,7 @@ static int of_state_fixup(struct device_node *root, void *ctx)
}
/* backend phandle */
- backend_node = of_find_node_by_path_from(root, state->of_backend_path);
+ backend_node = of_find_node_by_devpath(root, state->backend_path);
if (!backend_node) {
ret = -ENODEV;
goto out;
@@ -528,7 +528,7 @@ void state_release(struct state *state)
unregister_device(&state->dev);
state_storage_free(&state->storage);
state_format_free(state->format);
- free(state->of_backend_path);
+ free(state->backend_path);
free(state->of_path);
free(state);
}
@@ -590,6 +590,8 @@ struct state *state_new_from_node(struct device_node *node, char *path,
}
}
+ state->backend_path = xstrdup(path);
+
ret = of_property_read_string(node, "backend-type", &backend_type);
if (ret) {
goto out_release_state;
@@ -616,8 +618,6 @@ struct state *state_new_from_node(struct device_node *node, char *path,
if (ret)
goto out_release_state;
- state->of_backend_path = xstrdup(of_path);
-
if (readonly)
state_backend_set_readonly(state);
@@ -692,7 +692,7 @@ void state_info(void)
if (state->format)
printf("(backend: %s, path: %s)\n",
state->format->name,
- state->of_backend_path);
+ state->backend_path);
else
printf("(no backend)\n");
}
diff --git a/src/barebox-state/state.h b/src/barebox-state/state.h
index 5e240c4..ead8cc8 100644
--- a/src/barebox-state/state.h
+++ b/src/barebox-state/state.h
@@ -104,7 +104,7 @@ struct state {
struct state_backend_format *format;
struct state_backend_storage storage;
- char *of_backend_path;
+ char *backend_path;
};
enum state_convert {
diff --git a/src/dt/dt.h b/src/dt/dt.h
index 8014cd3..6d71a71 100644
--- a/src/dt/dt.h
+++ b/src/dt/dt.h
@@ -376,4 +376,10 @@ static inline int of_find_path_by_node(struct device_node *node, char **outpath,
return -ENOSYS;
}
+static inline struct device_node *of_find_node_by_devpath(struct device_node *root,
+ const char *path)
+{
+ return NULL;
+}
+
#endif /* __DT_DT_H */