From 1eddb0d3821d7bb368fa6b092b980b89fc47db28 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 20 Feb 2018 12:41:26 +0100 Subject: 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 --- common/state/state.c | 6 +++++- common/state/state.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'common/state') diff --git a/common/state/state.c b/common/state/state.c index c5a3fee407..73dfb586e7 100644 --- a/common/state/state.c +++ b/common/state/state.c @@ -480,7 +480,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; @@ -560,6 +561,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); } @@ -605,6 +607,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/common/state/state.h b/common/state/state.h index da1c6acaeb..6670523cbb 100644 --- a/common/state/state.h +++ b/common/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 { -- cgit v1.2.3