diff options
author | Ulrich Ölmann <u.oelmann@pengutronix.de> | 2018-12-18 14:57:54 +0100 |
---|---|---|
committer | Roland Hieber <rhi@pengutronix.de> | 2019-01-07 15:47:56 +0100 |
commit | 2157caeffeb08a18a4971a05807e37de701ad41b (patch) | |
tree | cc89358d0558184b8f9089ff2583b56b30b3d4fe | |
parent | 498e2d84d0867b9ba6dcf5b7613ca9983c673b33 (diff) | |
download | dt-utils-2157caeffeb08a18a4971a05807e37de701ad41b.tar.gz dt-utils-2157caeffeb08a18a4971a05807e37de701ad41b.tar.xz |
state: find backend node with its reproducible name
This ports the following barebox commit and removes the now no longer used noop
definition of of_find_node_by_devpath() that was introduced in commit "state:
find device node from device path, not from device node path":
| commit 1eddb0d3821d7bb368fa6b092b980b89fc47db28
| Author: Sascha Hauer <s.hauer@pengutronix.de>
| Date: Tue Feb 20 12:41:26 2018 +0100
|
| state: find backend node with its reproducible name
|
| When fixing up the kernels state nodes we depended on the full node path
| of the input device tree. This does not work when the kernel device tree
| has different names. This has happened lately when the i.MX6 device
| trees got their leading zeroes removed from the node names.
|
| Use of_find_node_by_reproducible_name() to find the node corresponding
| to the storage backend node in the kernel device tree.
|
| 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.c | 6 | ||||
-rw-r--r-- | src/barebox-state/state.h | 1 | ||||
-rw-r--r-- | src/dt/dt.h | 9 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/barebox-state/state.c b/src/barebox-state/state.c index d6ab464..0ec5664 100644 --- a/src/barebox-state/state.c +++ b/src/barebox-state/state.c @@ -479,7 +479,8 @@ static int of_state_fixup(struct device_node *root, void *ctx) } /* backend phandle */ - backend_node = of_find_node_by_devpath(root, state->backend_path); + backend_node = of_find_node_by_reproducible_name(root, + state->backend_reproducible_name); if (!backend_node) { ret = -ENODEV; goto out; @@ -559,6 +560,7 @@ void state_release(struct state *state) state_storage_free(&state->storage); state_format_free(state->format); free(state->backend_path); + free(state->backend_reproducible_name); free(state->of_path); free(state); } @@ -610,6 +612,8 @@ struct state *state_new_from_node(struct device_node *node, bool readonly) goto out_release_state; } + state->backend_reproducible_name = of_get_reproducible_name(partition_node); + ret = of_property_read_string(node, "backend-type", &backend_type); if (ret) { dev_dbg(&state->dev, "Missing 'backend-type' property\n"); diff --git a/src/barebox-state/state.h b/src/barebox-state/state.h index da1c6ac..6670523 100644 --- a/src/barebox-state/state.h +++ b/src/barebox-state/state.h @@ -115,6 +115,7 @@ struct state { struct state_backend_format *format; struct state_backend_storage storage; char *backend_path; + char *backend_reproducible_name; }; enum state_convert { diff --git a/src/dt/dt.h b/src/dt/dt.h index 10fe162..4ae24ba 100644 --- a/src/dt/dt.h +++ b/src/dt/dt.h @@ -370,8 +370,13 @@ static inline struct device_node *of_find_root_node(struct device_node *node) struct device_node *of_read_proc_devicetree(void); -static inline struct device_node *of_find_node_by_devpath(struct device_node *root, - const char *path) +static inline struct device_node *of_find_node_by_reproducible_name(struct device_node *from, + const char *name) +{ + return NULL; +} + +static inline char *of_get_reproducible_name(struct device_node *node) { return NULL; } |