[PATCH 5/8] state: rename backend members

Marco Felsch m.felsch at pengutronix.de
Fri Oct 14 09:35:31 PDT 2022


Rename backend members to drop the assumption that the backend always
points to a partition. This is preperation work for the upcoming
state partition table support which allows us to store the state within
a MBR/GPT partition.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
 common/state/state.c | 17 +++++++++--------
 common/state/state.h |  4 ++--
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/common/state/state.c b/common/state/state.c
index 65e47524a3..6b8b701ba0 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -493,7 +493,7 @@ static int of_state_fixup(struct device_node *root, void *ctx)
 
 	/* backend phandle */
 	backend_node = of_find_node_by_reproducible_name(root,
-						state->backend_reproducible_name);
+						state->backend_dts_dev_or_part);
 	if (!backend_node) {
 		ret = -ENODEV;
 		goto out;
@@ -572,8 +572,8 @@ void state_release(struct state *state)
 	unregister_device(&state->dev);
 	state_storage_free(&state->storage);
 	state_format_free(state->format);
-	free(state->backend_path);
-	free(state->backend_reproducible_name);
+	free(state->backend_dev_path);
+	free(state->backend_dts_dev_or_part);
 	free(state->of_path);
 	free(state);
 }
@@ -619,10 +619,11 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
 	if (ret)
 		goto out_release_state;
 
-	ret = of_find_path_by_node(backend_node, &state->backend_path, 0);
+	ret = of_find_path_by_node(backend_node, &state->backend_dev_path, 0);
 #else
-	ret = of_get_devicepath(backend_node, &state->backend_path, &offset, &size);
+	ret = of_get_devicepath(backend_node, &state->backend_dev_path, &offset, &size);
 #endif
+
 	if (ret) {
 		if (ret != -EPROBE_DEFER)
 			dev_err(&state->dev, "state failed to parse path to backend: %s\n",
@@ -630,7 +631,7 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
 		goto out_release_state;
 	}
 
-	state->backend_reproducible_name = of_get_reproducible_name(backend_node);
+	state->backend_dts_dev_or_part = of_get_reproducible_name(backend_node);
 
 	ret = of_property_read_string(node, "backend-type", &backend_type);
 	if (ret) {
@@ -653,7 +654,7 @@ struct state *state_new_from_node(struct device_node *node, bool readonly)
 	if (ret)
 		goto out_release_state;
 
-	ret = state_storage_init(state, state->backend_path, offset,
+	ret = state_storage_init(state, state->backend_dev_path, offset,
 				 size, stridesize, storage_type);
 	if (ret)
 		goto out_release_state;
@@ -766,7 +767,7 @@ void state_info(void)
 		if (state->format)
 			printf("(backend: %s, path: %s)\n",
 			       state->format->name,
-			       state->backend_path);
+			       state->backend_dev_path);
 		else
 			printf("(no backend)\n");
 	}
diff --git a/common/state/state.h b/common/state/state.h
index 0545cf6ac1..83a7fae4a5 100644
--- a/common/state/state.h
+++ b/common/state/state.h
@@ -119,8 +119,8 @@ struct state {
 
 	struct state_backend_format *format;
 	struct state_backend_storage storage;
-	char *backend_path;
-	char *backend_reproducible_name;
+	char *backend_dev_path;
+	char *backend_dts_dev_or_part;
 };
 
 enum state_convert {
-- 
2.30.2




More information about the barebox mailing list